bug81159.phpt 418 B

123456789101112131415161718192021
  1. --TEST--
  2. Bug #81159: Object to int warning when using an object as a string offset
  3. --FILE--
  4. <?php
  5. $s = 'Hello';
  6. $o = new stdClass();
  7. try {
  8. $s[$o] = 'A';
  9. } catch (\Throwable $e) {
  10. echo $e->getMessage(), "\n";
  11. }
  12. try {
  13. var_dump($s[$o]);
  14. } catch (\Throwable $e) {
  15. echo $e->getMessage(), "\n";
  16. }
  17. ?>
  18. --EXPECT--
  19. Cannot access offset of type stdClass on string
  20. Cannot access offset of type stdClass on string