pollita         Wed Jul  4 05:05:58 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/simplexml      simplexml.c 
    /php-src    NEWS 
  Log:
  MFH (r-1.240)
  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.151.2.22.2.31&r2=1.151.2.22.2.32&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.31 
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.32
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.31   Tue Jul  3 14:55:53 2007
+++ php-src/ext/simplexml/simplexml.c   Wed Jul  4 05:05:57 2007
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.151.2.22.2.31 2007/07/03 14:55:53 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.32 2007/07/04 05:05:57 pollita Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -787,6 +787,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) {
@@ -809,6 +814,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;
+                               }
                        }
                }
        }
@@ -2420,7 +2430,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.31 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.32 $");
        php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
                "enabled");
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.813&r2=1.2027.2.547.2.814&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.813 php-src/NEWS:1.2027.2.547.2.814
--- php-src/NEWS:1.2027.2.547.2.813     Tue Jul  3 15:03:16 2007
+++ php-src/NEWS        Wed Jul  4 05:05:57 2007
@@ -37,6 +37,7 @@
   (Ilia)
 - Fixed INFILE LOCAL option handling with MySQL extensions not to be allowed 
   when open_basedir or safe_mode is active. (Stas)
+- Faxed SimpleXML's behavior when used with empty(). (Sara)
 
 - Fixed PECL Bug #11345 (PDO_OCI crash after National language Support
   "NLS" environment initialization error) (Chris Jones)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to