bug79155.phpt 517 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #79155: Property nullability lost when using multiple property definition
  3. --FILE--
  4. <?php
  5. class Foo {
  6. public ?string $a, $b;
  7. public ?stdClass $c, $d;
  8. }
  9. $t = new Foo;
  10. $t->a = "str";
  11. $t->b = "str";
  12. $t->c = new stdClass;
  13. $t->d = new stdClass;
  14. var_dump($t->a, $t->b, $t->c, $t->d);
  15. $t->a = null;
  16. $t->b = null;
  17. $t->c = null;
  18. $t->d = null;
  19. var_dump($t->a, $t->b, $t->c, $t->d);
  20. ?>
  21. --EXPECT--
  22. string(3) "str"
  23. string(3) "str"
  24. object(stdClass)#2 (0) {
  25. }
  26. object(stdClass)#3 (0) {
  27. }
  28. NULL
  29. NULL
  30. NULL
  31. NULL