Bug #80572 [NEW]: accessing array element that has an empty value does not work

From: Date: Fri, 01 Jan 2021 19:53:54 +0000
Subject: Bug #80572 [NEW]: accessing array element that has an empty value does not work
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231324@lists.php.net to get a copy of this message
From: gkroll at keldine dot ca Operating system: all PHP version: 7.4.13 Package: Session related Bug Type: Bug Bug description:accessing array element that has an empty value does not work Description: ------------ When an array element is set to the value '' (it's empty), any attempt to access the value of that array element causes a nonsense error message: ERROR 8: Trying to access array offset on value of type bool Test script: --------------- $xyz = array ('a'=>'value1', 'b'=>'', 'c'=>'value3'); var_dump ($xyz); echo '<br />'; // let's see what we have if (isset($xyz['b'])) $foo = $xyz['b']; // no complaints here $foo = $xyz['b']; // this crashes echo 'foo is set to:', $foo, ': end', '<br />'; Expected result: ---------------- PHP 7.0 and earlier output: array(3) { ["a"]=> string(6) "value1" ["b"]=> string(0) "" ["c"]=> string(6) "value3" } foo is set to:: end I believe PHP 7.3 works too. Actual result: -------------- PHP 7.4 outputs: ERROR 8: Trying to access array offset on value of type bool -- Edit bug report at https://bugs.php.net/bug.php?id=80572&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80572&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80572&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80572&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80572&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80572&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80572&r=support Expected behavior: https://bugs.php.net/fix.php?id=80572&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80572&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80572&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80572&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80572&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80572&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80572&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80572&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80572&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80572&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80572&r=mysqlcfg

« previous php.bugs (#231324) next »