|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2021-04-20 18:23 UTC] girgias@php.net
[2021-04-26 12:23 UTC] git@php.net
[2021-04-26 12:23 UTC] git@php.net
-Status: Open
+Status: Closed
[2021-04-26 13:00 UTC] git@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ On a very large float-string string offset a memory exhaustion error kills the process although this could be prevented because a TypeError has already been thrown. This bug is limited to PHP 8, as prior to this version invalid string offsets only emitted an E_WARNING. Test script: --------------- <?php $float = 10e120; $string_float = (string) $float; $string = 'Here is some text for good measure'; try { echo 'Float casted to string compile', \PHP_EOL; $string[(string) 10e120] = 'E'; var_dump($string); } catch (\TypeError $e) { echo 'TypeError', \PHP_EOL; } ?> Expected result: ---------------- Float casted to string compile TypeError Actual result: -------------- Float casted to string compile Warning: Uncaught TypeError: Cannot access offset of type string on string in /in/HlIY7:10 Stack trace: #0 {main} thrown in /in/HlIY7 on line 10 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9223372036854775840 bytes) in /in/HlIY7 on line 10 Process exited with code 255.