|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 + 43 = ?
Subscribe to this entry?

 [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: Mon Aug 15 04:05:45 2022 UTC