php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78598 Changing array during undef index RW error segfaults
Submitted: 2019-09-26 10:44 UTC Modified: 2020-11-18 19:25 UTC
From: nikic@php.net Assigned: requinix (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.2.22 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nikic@php.net
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2019-09-26 10:44 UTC] nikic@php.net
Description:
------------
After the undef index notice is thrown, we still assume that the variable is an array, even though the type might have changed in the meantime.

Not really sure what we can do about this, especially when we're dealing with a deeply nested array that has been destroyed.

Test script:
---------------
<?php
$my_var = null;
set_error_handler(function() use(&$my_var) {
    $my_var = 0;
});
$my_var[0] .= "xyz";


Actual result:
--------------
php: /home/nikic/php-7.2/Zend/zend_hash.c:712: _zend_hash_index_add_or_update_i: Assertion `((ht)->gc.refcount == 1) || ((ht)->u.flags & (1<<6))' failed.
Aborted
nikic@MUNIT-271:~/php-7.2$ vim t036.php 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-07 10:29 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=220880ad2d54d10173a250637478da213b1ae8e2
Log: Fixed bug #78598
 [2020-07-07 10:29 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2020-11-18 19:25 UTC] requinix@php.net
-Assigned To: +Assigned To: requinix -Block user comment: No +Block user comment: Yes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 21:01:31 2024 UTC