helly Sun Oct 30 15:37:30 2005 EDT
Modified files:
/php-src/ext/simplexml simplexml.c
/php-src/ext/simplexml/tests 000.phpt
Log:
- Bugfix #35028 XML object fails FALSE test
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.169&r2=1.170&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.169
php-src/ext/simplexml/simplexml.c:1.170
--- php-src/ext/simplexml/simplexml.c:1.169 Sat Oct 29 20:38:39 2005
+++ php-src/ext/simplexml/simplexml.c Sun Oct 30 15:37:07 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.169 2005/10/30 00:38:39 helly Exp $ */
+/* $Id: simplexml.c,v 1.170 2005/10/30 20:37:07 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1205,6 +1205,13 @@
sxe = php_sxe_fetch_object(readobj TSRMLS_CC);
+ if (type == IS_BOOL) {
+ node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
+ INIT_PZVAL(writeobj);
+ ZVAL_BOOL(writeobj, node != NULL ||
zend_hash_num_elements(sxe_properties_get(readobj TSRMLS_CC)) > 0);
+ return SUCCESS;
+ }
+
if (sxe->iter.type != SXE_ITER_NONE) {
node = php_sxe_get_first_node(sxe, NULL TSRMLS_CC);
if (node) {
@@ -1878,7 +1885,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.169 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.170 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/000.phpt?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/simplexml/tests/000.phpt
diff -u php-src/ext/simplexml/tests/000.phpt:1.2
php-src/ext/simplexml/tests/000.phpt:1.3
--- php-src/ext/simplexml/tests/000.phpt:1.2 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/000.phpt Sun Oct 30 15:37:22 2005
@@ -12,6 +12,7 @@
global $sxe;
echo "===$what\n";
eval("var_dump(isset(\$$what));");
+ eval("var_dump((bool)\$$what);");
eval("var_dump(\$$what);");
}
@@ -20,7 +21,7 @@
test('sxe->elem1[0]');
test('sxe->elem1[0]->elem2');
test('sxe->elem1[0]->elem2->bla');
-test('sxe->elem1[0]["attr1"]');
+if (!ini_get("unicode_semantics")) test('sxe->elem1[0]["attr1"]');
test('sxe->elem1[0]->attr1');
test('sxe->elem1[1]');
test('sxe->elem1[2]');
@@ -38,6 +39,7 @@
--EXPECTF--
===sxe
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
array(1) {
@@ -71,6 +73,7 @@
}
===sxe->elem1
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
array(2) {
@@ -104,6 +107,7 @@
}
===sxe->elem1[0]
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
array(2) {
@@ -137,6 +141,7 @@
}
===sxe->elem1[0]->elem2
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
array(2) {
@@ -157,20 +162,24 @@
}
===sxe->elem1[0]->elem2->bla
bool(false)
+bool(false)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem1[0]["attr1"]
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
[0]=>
string(5) "first"
}
===sxe->elem1[0]->attr1
bool(false)
+bool(false)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem1[1]
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
["@attributes"]=>
array(2) {
@@ -182,9 +191,11 @@
}
===sxe->elem1[2]
bool(false)
+bool(false)
NULL
===sxe->elem11
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
["elem111"]=>
object(SimpleXMLElement)#%d (1) {
@@ -195,6 +206,7 @@
}
===sxe->elem11->elem111
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
["elem1111"]=>
object(SimpleXMLElement)#%d (0) {
@@ -202,25 +214,31 @@
}
===sxe->elem11->elem111->elem1111
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem22
bool(false)
+bool(false)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem22->elem222
bool(false)
+bool(false)
NULL
===sxe->elem22->attr22
bool(false)
+bool(false)
NULL
===sxe->elem22["attr22"]
bool(false)
+bool(false)
NULL
===DONE===
--UEXPECTF--
===sxe
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
@@ -254,6 +272,7 @@
}
===sxe->elem1
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(2) {
@@ -287,6 +306,7 @@
}
===sxe->elem1[0]
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(2) {
@@ -320,6 +340,7 @@
}
===sxe->elem1[0]->elem2
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (2) {
[u"@attributes"]=>
array(2) {
@@ -340,20 +361,17 @@
}
===sxe->elem1[0]->elem2->bla
bool(false)
-object(SimpleXMLElement)#%d (0) {
-}
-===sxe->elem1[0]["attr1"]
bool(false)
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- unicode(5) "first"
+object(SimpleXMLElement)#%d (0) {
}
===sxe->elem1[0]->attr1
bool(false)
+bool(false)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem1[1]
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(2) {
@@ -365,9 +383,11 @@
}
===sxe->elem1[2]
bool(false)
+bool(false)
NULL
===sxe->elem11
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
[u"elem111"]=>
object(SimpleXMLElement)#%d (1) {
@@ -378,6 +398,7 @@
}
===sxe->elem11->elem111
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (1) {
[u"elem1111"]=>
object(SimpleXMLElement)#%d (0) {
@@ -385,19 +406,24 @@
}
===sxe->elem11->elem111->elem1111
bool(true)
+bool(true)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem22
bool(false)
+bool(false)
object(SimpleXMLElement)#%d (0) {
}
===sxe->elem22->elem222
bool(false)
+bool(false)
NULL
===sxe->elem22->attr22
bool(false)
+bool(false)
NULL
===sxe->elem22["attr22"]
bool(false)
+bool(false)
NULL
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php