assign_040.phpt 552 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. JIT ASSIGN: Typed reference error with return value
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. opcache.file_update_protection=0
  7. opcache.jit_buffer_size=1M
  8. opcache.protect_memory=1
  9. --FILE--
  10. <?php
  11. class Test {
  12. public string $x;
  13. }
  14. function test() {
  15. $test = new Test;
  16. $test->x = "";
  17. $r =& $test->x;
  18. +($r = $y);
  19. }
  20. try {
  21. test();
  22. } catch (TypeError $e) {
  23. echo $e->getMessage(), "\n";
  24. }
  25. --EXPECTF--
  26. Warning: Undefined variable $y in %s on line %d
  27. Cannot assign null to reference held by property Test::$x of type string