php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79817 str_replace() does not handle INDIRECT elements
Submitted: 2020-07-09 05:36 UTC Modified: 2020-07-10 11:13 UTC
From: changochen1 at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.3.20 OS:
Private report: No CVE-ID: None
 [2020-07-09 05:36 UTC] changochen1 at gmail dot com
Description:
------------
php: /home/yongheng/php_clean/Zend/zend_operators.c:915: zend_string *__zval_get_string_func(zval *, zend_bool): Assertion `0' failed.

Test script:
---------------
<?
switch ( $a ) {
    case str_replace('x' , array () , $GLOBALS );
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-09 07:10 UTC] cmb@php.net
-Status: Open +Status: Verified -PHP Version: 8.0Git-2020-07-09 (Git) +PHP Version: 7.3.20
 [2020-07-09 07:10 UTC] cmb@php.net
The problem is that we're passing an IS_INDIRECT value to
zval_get_tmp_string()[1] which doesn't expect that.

[1] <https://github.com/php/php-src/blob/PHP-7.3/ext/standard/string.c#L4285>
 [2020-07-10 11:13 UTC] nikic@php.net
-Summary: Assertion `0' failed. in __zval_get_string_func +Summary: str_replace() does not handle INDIRECT elements -Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2020-07-10 12:10 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=a72c53a0707db617ba0cf55d639bc188c3aa8ede
Log: Fixed bug #79817
 [2020-07-10 12:10 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC