cvs: php-src /ext/simplexml simplexml.c
| From: | Sara Golemon | Date: | Wed, 04 Jul 2007 05:05:32 +0000 |
| Subject: | cvs: php-src /ext/simplexml simplexml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-45091@lists.php.net to get a copy of this message | ||
pollita Wed Jul 4 05:05:32 2007 UTC
Modified files:
/php-src/ext/simplexml simplexml.c
Log:
Fix behavior of empty($sxe->element) and empty($sxe['prop'])
when used on empty elements properties (apply PHP emptiness rules)
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.239&r2=1.240&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.239 php-src/ext/simplexml/simplexml.c:1.240
--- php-src/ext/simplexml/simplexml.c:1.239 Tue Jul 3 15:02:40 2007
+++ php-src/ext/simplexml/simplexml.c Wed Jul 4 05:05:32 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.239 2007/07/03 15:02:40 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.240 2007/07/04 05:05:32 pollita Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -797,6 +797,11 @@
attr = attr->next;
}
}
+ if (exists && check_empty == 1 &&
+ (!attr->children || !attr->children->content || !attr->children->content[0] ||
!xmlStrcmp(attr->children->content, "0")) ) {
+ /* Attribute with no content in it's text node */
+ exists = 0;
+ }
}
if (elements) {
@@ -819,6 +824,11 @@
}
if (node) {
exists = 1;
+ if (check_empty == 1 &&
+ (!node->children || (node->children->type == XML_TEXT_NODE &&
!node->children->next &&
+ (!node->children->content || !node->children->content[0] ||
!xmlStrcmp(node->children->content, "0")))) ) {
+ exists = 0;
+ }
}
}
}
@@ -2483,7 +2493,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.239 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.240 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");