Bug #81377 [NEW]: unset() of $GLOBALS sub-key yields warning

From: Date: Sat, 21 Aug 2021 20:00:40 +0000
Subject: Bug #81377 [NEW]: unset() of $GLOBALS sub-key yields warning
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235989@lists.php.net to get a copy of this message
From: fmg at inspiredminds dot at Operating system: PHP version: 8.1Git-2021-08-21 (Git) Package: *General Issues Bug Type: Bug Bug description:unset() of $GLOBALS sub-key yields warning Description: ------------ Trying to unset a sub-key in $GLOBALS yields an "Undefined global variable $foo" warning in PHP 8.1. See https://3v4l.org/3TLGo vs. https://3v4l.org/3TLGo/rfc for instance. The latter yields: Warning: Undefined global variable $foo in /in/3TLGo on line 4 only in the current master version (for PHP 8.1). Test script: --------------- // This is fine unset($GLOBALS['foo']); // This yields an "Undefined global variable $foo" warning unset($GLOBALS['foo']['bar']); Expected result: ---------------- unset() should not yield warnings for undefined $GLOBALS sub-keys. Actual result: -------------- The second unset() yields "Warning: Undefined global variable $foo" -- Edit bug report at https://bugs.php.net/bug.php?id=81377&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81377&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81377&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81377&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81377&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81377&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81377&r=support Expected behavior: https://bugs.php.net/fix.php?id=81377&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81377&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81377&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81377&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81377&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81377&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81377&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81377&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81377&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81377&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81377&r=mysqlcfg

« previous php.bugs (#235989) next »