php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76383 array_map on $GLOBALS returns IS_INDIRECT
Submitted: 2018-05-27 22:47 UTC Modified: -
From: bwoebi@php.net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.2Git-2018-05-27 (Git) OS: Irrelevant
Private report: No CVE-ID: None
 [2018-05-27 22:47 UTC] bwoebi@php.net
Description:
------------
Since PHP 7, an array_map on $GLOBALS returns an IS_INDIRECT zval instead of a value.

Test script:
---------------
array_map(function($x) use (&$lastval) { $lastval = $x; }, $GLOBALS);

extract([], 0, $lastval); // for example, anything that will fail on an invalid type

// or for direct proof, giving unknown type
var_dump(gettype($lastval));

Expected result:
----------------
NULL // on gettype

Actual result:
--------------
Assertion failed: (0), function _convert_to_string, file /Users/Bob/php-src-X/Zend/zend_operators.c, line 585.
Abort trap: 6


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-27 22:48 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=97a84831432a9b727235ee4727905919681aeac4
Log: Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
 [2018-05-27 22:48 UTC] bwoebi@php.net
-Status: Open +Status: Closed
 [2018-05-28 15:16 UTC] ab@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=97a84831432a9b727235ee4727905919681aeac4
Log: Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC