Bug #75451 [NEW]: Assertion fails while foreach on empty xpath query

From: Date: Sat, 28 Oct 2017 13:37:09 +0000
Subject: Bug #75451 [NEW]: Assertion fails while foreach on empty xpath query
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212347@lists.php.net to get a copy of this message
From: laruence Operating system: PHP version: master-Git-2017-10-28 (Git) Package: *General Issues Bug Type: Bug Bug description:Assertion fails while foreach on empty xpath query Description: ------------ none Test script: --------------- <?php $dom = new DOMDocument(); $dom->loadXML('<root><child/></root>'); $xpath = new DOMXpath($dom); foreach($xpath->query('/root/noexist') as $child) { var_dump($child); } Expected result: ---------------- no error Actual result: -------------- php: /home/huixinchen/opensource/trunk/Zend/zend_hash.c:2036: zend_hash_internal_pointer_reset_ex: Assertion `(&ht->nInternalPointer != pos || (ht)->gc.refcount == 1) || ((ht)->u.flags & (1<<6))' failed. Program received signal SIGABRT, Aborted. 0x00007ffff5f685e5 in raise () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff5f685e5 in raise () from /lib64/libc.so.6 #1 0x00007ffff5f69dc5 in abort () from /lib64/libc.so.6 #2 0x00007ffff5f6170e in __assert_fail_base () from /lib64/libc.so.6 #3 0x00007ffff5f617d0 in __assert_fail () from /lib64/libc.so.6 #4 0x0000000000a54504 in zend_hash_internal_pointer_reset_ex (ht=0x1530080 <zend_empty_array>, pos=0x15300a4 <zend_empty_array+36>) at /home/huixinchen/opensource/trunk/Zend/zend_hash.c:2036 #5 0x0000000000685c71 in php_dom_get_iterator (ce=0x1636300, object=0x7ffff2c200c0, by_ref=0) at /home/huixinchen/opensource/trunk/ext/dom/dom_iterators.c:284 #6 0x0000000000ac0d65 in ZEND_FE_RESET_R_SPEC_VAR_HANDLER () at /home/huixinchen/opensource/trunk/Zend/zend_vm_execute.h:16819 #7 0x0000000000b1ee91 in execute_ex (ex=0x7ffff2c20030) at /home/huixinchen/opensource/trunk/Zend/zend_vm_execute.h:61331 #8 0x0000000000b22c39 in zend_execute (op_array=0x7ffff2c80300, return_value=0x0) at /home/huixinchen/opensource/trunk/Zend/zend_vm_execute.h:64280 #9 0x0000000000a3d2a8 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/huixinchen/opensource/trunk/Zend/zend.c:1510 #10 0x00000000009ab1fd in php_execute_script (primary_file=0x7fffffffe130) at /home/huixinchen/opensource/trunk/main/main.c:2455 #11 0x0000000000b25508 in do_cli (argc=2, argv=0x1580d50) at /home/huixinchen/opensource/trunk/sapi/cli/php_cli.c:1011 #12 0x0000000000b264a7 in main (argc=2, argv=0x1580d50) at /home/huixinchen/opensource/trunk/sapi/cli/php_cli.c:1404 -- Edit bug report at https://bugs.php.net/bug.php?id=75451&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75451&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75451&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75451&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75451&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75451&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75451&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75451&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75451&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75451&r=support Expected behavior: https://bugs.php.net/fix.php?id=75451&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75451&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75451&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75451&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75451&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75451&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75451&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75451&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75451&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75451&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75451&r=mysqlcfg

« previous php.bugs (#212347) next »