|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-06-17 22:01 UTC] girgias@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: girgias
[2021-06-18 17:12 UTC] git@php.net
[2021-06-18 17:12 UTC] git@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ As of PHP 8.0 objects cannot be used as string offsets, but they still emit an E_WARNING about conversion to int on top of the TypeError Test script: --------------- <?php $s = 'Hello'; $o = new stdClass(); try { $s[$o] = 'A'; } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump($s[$o]); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } ?> Expected result: ---------------- Cannot access offset of type stdClass on string Cannot access offset of type stdClass on string Actual result: -------------- Warning: Object of class stdClass could not be converted to int in /in/YhEYe on line 11 Cannot access offset of type stdClass on string Warning: Object of class stdClass could not be converted to int in /in/YhEYe on line 16 Cannot access offset of type stdClass on string