|  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
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.
Block user comment
Status: Assign to:
Bug Type:
From: moonlighterr at gmail dot com
New email:
PHP Version: OS:


 [2019-10-29 21:58 UTC] moonlighterr at gmail dot com
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"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-30 09:06 UTC]
-Status: Open +Status: Verified
 [2019-10-30 09:06 UTC]
The $strict case is already broken as of PHP 7.0.0, the non
$strict case as of 7.4.0, see <>.
 [2019-11-07 10:17 UTC]
Automatic comment on behalf of
Log: Fixed bug #78759
 [2019-11-07 10:17 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Aug 13 05:05:43 2022 UTC