|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Wed Aug 10 18:05:46 2022 UTC