rrichards               Wed Sep 10 16:28:20 2008 UTC

  Added files:                 
    /php-src/ext/simplexml/tests        bug46003.phpt 

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
  Log:
  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.259&r2=1.260&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.259 
php-src/ext/simplexml/simplexml.c:1.260
--- php-src/ext/simplexml/simplexml.c:1.259     Wed Sep 10 11:20:35 2008
+++ php-src/ext/simplexml/simplexml.c   Wed Sep 10 16:28:20 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.259 2008/09/10 11:20:35 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.260 2008/09/10 16:28:20 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -829,7 +829,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;
@@ -2640,7 +2640,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.259 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.260 $");
        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