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
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: moonlighterr at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat Apr 20 15:01:29 2024 UTC