|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-06-17 22:03 UTC] girgias@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: girgias
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 13:00:01 2025 UTC |
Description: ------------ An invalid array offset will trigger a TypeError when used in isset/empty. The same should be done for string offsets. Test script: --------------- <?php $s = 'Hello'; $o = new stdClass(); $a = []; try { var_dump(isset($s[$o])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump(empty($s[$o])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump(isset($s[$a])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump(empty($s[$a])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump(isset($s[[]])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } try { var_dump(empty($s[[]])); } catch (\Throwable $e) { echo $e->getMessage(), "\n"; } ?>