rrichards               Wed Sep 10 16:29:18 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/simplexml/tests        bug46003.phpt 

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
  Log:
  MFH: fix bug #46003 (isset on nonexisting node return unexpected results)
  add test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.42&r2=1.151.2.22.2.43&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.42 
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.43
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.42   Wed Sep 10 11:21:48 2008
+++ php-src/ext/simplexml/simplexml.c   Wed Sep 10 16:29:17 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.151.2.22.2.42 2008/09/10 11:21:48 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.43 2008/09/10 16:29:17 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -800,7 +800,7 @@
                                while (node) {
                                        xmlNodePtr nnext;
                                        nnext = node->next;
-                                       if (!xmlStrcmp(node->name, (xmlChar 
*)Z_STRVAL_P(member))) {
+                                       if ((node->type == XML_ELEMENT_NODE) && 
!xmlStrcmp(node->name, (xmlChar *)Z_STRVAL_P(member))) {
                                                break;
                                        }
                                        node = nnext;
@@ -2446,7 +2446,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.42 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.43 $");
        php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
                "enabled");

http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug46003.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/bug46003.phpt
+++ php-src/ext/simplexml/tests/bug46003.phpt
--TEST--
Bug #46003 (isset on nonexisting nodes return unexpected results)
--FILE--
<?php
$xml =<<<XML
<r>
  <p>Test</p>
  <o d='h'>
    <xx rr='info' />
    <yy rr='data' />
  </o>
</r>
XML;

$x = simplexml_load_string($xml);

var_dump(isset($x->p));
var_dump(isset($x->p->o));
var_dump(isset($x->o->yy));
var_dump(isset($x->o->zz));
var_dump(isset($x->o->text));
var_dump(isset($x->o->xx));
?>
--EXPECTF--
bool(true)
bool(false)
bool(true)
bool(false)
bool(false)
bool(true)


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

Reply via email to