Bug #71721 [Opn->Dup]: array_key_exists on $GLOBALS

From: Date: Sun, 06 Mar 2016 15:54:43 +0000
Subject: Bug #71721 [Opn->Dup]: array_key_exists on $GLOBALS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199629@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71721&edit=1 ID: 71721 Updated by: requinix@php.net Reported by: asylow at free dot fr Summary: array_key_exists on $GLOBALS -Status: Open +Status: Duplicate Type: Bug Package: *General Issues PHP Version: 7.0.4 Block user comment: N Private report: N New Comment: Duplicate of bug #71695 Previous Comments: ------------------------------------------------------------------------ [2016-03-06 08:31:21] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71721&edit=1

« previous php.bugs (#199629) next »