php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71721 array_key_exists on $GLOBALS
Submitted: 2016-03-06 08:31 UTC Modified: 2016-03-06 15:54 UTC
From: asylow at free dot fr Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 7.0.4 OS:
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: asylow at free dot fr
New email:
PHP Version: OS:

 

 [2016-03-06 08:31 UTC] asylow at free dot fr
Description:
------------
Testing $GLOBALS with array_key_exists() gives TRUE as soon as the variable is names anywhere in the code.

This behaviour was not reproduced in PHP7.0.0 or PHP5.

Test script:
---------------
<?php
var_dump(array_key_exists('var', $GLOBALS)); // false
?>

with a var affected after :
<?php
var_dump(array_key_exists('var', $GLOBALS)); // true
$var = 'foo';
?>

with a var simply named in the code:
<?php
var_dump(array_key_exists('var', $GLOBALS)); // true
if (1 == 0) { $var = 'foo'; }
?>

Expected result:
----------------
All tests should give false.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-06 15:54 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2016-03-06 15:54 UTC] requinix@php.net
Duplicate of bug #71695
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 19:01:51 2019 UTC