Bug #80532 [NEW]: assigning value to string at high index(1e9) results in out of memory error

From: Date: Sat, 19 Dec 2020 07:50:11 +0000
Subject: Bug #80532 [NEW]: assigning value to string at high index(1e9) results in out of memory error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231165@lists.php.net to get a copy of this message
From: Srglmr at gmail dot com Operating system: windows 10 & CentOS 7 PHP version: 7.3.25 Package: *General Issues Bug Type: Bug Bug description:assigning value to string at high index(1e9) results in out of memory error Description: ------------ $X="1"; $X[1e9]=0; // Allowed memory size of 536870912 bytes exhausted (tried to allocate 1000000032 bytes) Test script: --------------- $X="1"; $X[1e9]=0; Expected result: ---------------- i expect an error telling me that i can't assign by index if the variable is string , but instead it shows out of memory error which is very confusing error i encountered the error while trying to do something like this $S[Time()]=0; thinking that $S is an empty array ( $S = [] ) while it was a string $S = "100" -- Edit bug report at https://bugs.php.net/bug.php?id=80532&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80532&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80532&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80532&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80532&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80532&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80532&r=support Expected behavior: https://bugs.php.net/fix.php?id=80532&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80532&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80532&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80532&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80532&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80532&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80532&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80532&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80532&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80532&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80532&r=mysqlcfg

« previous php.bugs (#231165) next »