Bug #75451 [Opn->Csd]: Assertion fails while foreach on empty xpath query
| From: | laruence@php.net | Date: | Sat, 28 Oct 2017 13:38:49 +0000 |
| Subject: | Bug #75451 [Opn->Csd]: Assertion fails while foreach on empty xpath query | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212348@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75451&edit=1
ID: 75451
Updated by: laruence@php.net
Reported by: laruence@php.net
Summary: Assertion fails while foreach on empty xpath query
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
PHP Version: master-Git-2017-10-28 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a9e64362cdfc6911ecda32d507dab0994909e0a
Log: Fixed bug #75451 (Assertion fails while foreach on empty xpath query)
Previous Comments:
------------------------------------------------------------------------
[2017-10-28 13:37:02] laruence@php.net
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 this bug report at https://bugs.php.net/bug.php?id=75451&edit=1