php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75451 Assertion fails while foreach on empty xpath query
Submitted: 2017-10-28 13:37 UTC Modified: -
From: laruence@php.net Assigned:
Status: Closed Package: *General Issues
PHP Version: master-Git-2017-10-28 (Git) OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2017-10-28 13:37 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-28 13:38 UTC] laruence@php.net
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)
 [2017-10-28 13:38 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC