php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78759 array_search in $GLOBALS
Submitted: 2019-10-29 21:58 UTC Modified: 2019-10-30 09:06 UTC
From: moonlighterr at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.4.0RC4 OS: any?
Private report: No CVE-ID: None
 [2019-10-29 21:58 UTC] moonlighterr at gmail dot com
Description:
------------
Seems array_search have some problems with $GLOBALS array. Direct index calling works fine, searching by value in array_search not, similar with 'true' third parameter.

Test script:
---------------
$a = 22;
var_dump($GLOBALS["a"]); // int 22
var_dump(array_search(22, $GLOBALS)); // false
var_dump(array_search(22, $GLOBALS, true)); // false

Expected result:
----------------
$a = 22;
var_dump($GLOBALS["a"]); // int 22
var_dump(array_search(22, $GLOBALS)); // string "a"
var_dump(array_search(22, $GLOBALS, true)); // string "a"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-30 09:06 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2019-10-30 09:06 UTC] cmb@php.net
The $strict case is already broken as of PHP 7.0.0, the non
$strict case as of 7.4.0, see <https://3v4l.org/eFFTd>.
 [2019-11-07 10:17 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=5fa6dcd972e868fd6177b6620b44734d55eceab3
Log: Fixed bug #78759
 [2019-11-07 10:17 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 16 08:01:27 2024 UTC