? ext/simplexml/.simplexml.c.swp Index: ext/simplexml/simplexml.c =================================================================== RCS file: /repository/php-src/ext/simplexml/simplexml.c,v retrieving revision 1.252 diff -u -p -r1.252 simplexml.c --- ext/simplexml/simplexml.c 31 Jan 2008 21:58:09 -0000 1.252 +++ ext/simplexml/simplexml.c 19 Mar 2008 23:19:11 -0000 @@ -2159,6 +2159,22 @@ PHP_FUNCTION(simplexml_load_string) } /* }}} */ +/* {{{ proto SimpleXMLElement::__toString() U + Returns the object as a string */ +SXE_METHOD(__toString) +{ + zval *retval; + ALLOC_INIT_ZVAL(retval); + + if (sxe_object_cast(getThis(), retval, UG(unicode)?IS_UNICODE:IS_STRING, NULL TSRMLS_CC)==FAILURE) { + zend_error(E_ERROR, "Unable to cast node to string"); + /* FIXME: Should not be fatal */ + } + + RETURN_ZVAL(retval, 1, 1); +} +/* }}} */ + /* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]]) U SimpleXMLElement constructor */ SXE_METHOD(__construct) @@ -2490,6 +2506,7 @@ ZEND_GET_MODULE(simplexml) /* each method can have its own parameters and visibility */ static const zend_function_entry sxe_functions[] = { /* {{{ */ SXE_ME(__construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */ + SXE_ME(__toString, NULL, ZEND_ACC_PUBLIC) SXE_ME(asXML, NULL, ZEND_ACC_PUBLIC) SXE_MALIAS(saveXML, asXML, NULL, ZEND_ACC_PUBLIC) SXE_ME(xpath, NULL, ZEND_ACC_PUBLIC)