helly Sun Feb 26 13:37:54 2006 UTC
Added files:
/php-src/ext/simplexml/tests 028.phpt
Modified files:
/php-src/ext/simplexml simplexml.c
Log:
- Add another write case
http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.190&r2=1.191&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.190
php-src/ext/simplexml/simplexml.c:1.191
--- php-src/ext/simplexml/simplexml.c:1.190 Sun Feb 26 12:00:39 2006
+++ php-src/ext/simplexml/simplexml.c Sun Feb 26 13:37:54 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.190 2006/02/26 12:00:39 helly Exp $ */
+/* $Id: simplexml.c,v 1.191 2006/02/26 13:37:54 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -451,9 +451,14 @@
attr = (xmlAttrPtr)node;
test = sxe->iter.name != NULL;
} else if (sxe->iter.type != SXE_ITER_CHILD) {
+ mynode = node;
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
attr = node ? node->properties : NULL;
test = 0;
+ if (attribs && !node && sxe->iter.type == SXE_ITER_ELEMENT) {
+ node = xmlNewChild(mynode, mynode->ns, sxe->iter.name,
NULL);
+ attr = node->properties;
+ }
}
mynode = node;
@@ -2067,7 +2072,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.190 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.191 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/tests/028.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/028.phpt
+++ php-src/ext/simplexml/tests/028.phpt
--TEST--
SimpleXML: Adding an elements without text
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml =<<<EOF
<people></people>
EOF;
function traverse_xml($xml, $pad = '')
{
$name = $xml->getName();
echo "$pad<$name";
foreach($xml->attributes() as $attr => $value)
{
echo " $attr=\"$value\"";
}
echo ">" . trim($xml) . "\n";
foreach($xml->children() as $node)
{
traverse_xml($node, $pad.' ');
}
echo $pad."</$name>\n";
}
$people = simplexml_load_string($xml);
traverse_xml($people);
$people->person['name'] = 'John';
traverse_xml($people);
?>
===DONE===
--EXPECTF--
<people>
</people>
<people>
<person name="John">
</person>
</people>
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php