rrichards               Wed Sep 10 16:28:53 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /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.35.2.18&r2=1.151.2.22.2.35.2.19&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.18 
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.19
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.35.2.18      Wed Sep 10 
11:21:12 2008
+++ php-src/ext/simplexml/simplexml.c   Wed Sep 10 16:28:53 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.151.2.22.2.35.2.18 2008/09/10 11:21:12 rrichards Exp $ 
*/
+/* $Id: simplexml.c,v 1.151.2.22.2.35.2.19 2008/09/10 16:28:53 rrichards Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -821,7 +821,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;
@@ -2558,7 +2558,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.35.2.18 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 
1.151.2.22.2.35.2.19 $");
        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