no-pass-properties-by-ref.phpt 392 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Enum properties cannot be passed by-ref
  3. --FILE--
  4. <?php
  5. enum Foo: int {
  6. case Bar = 0;
  7. }
  8. function setBarValueByRef(&$bar, $value) {
  9. $bar = $value;
  10. }
  11. try {
  12. $bar = Foo::Bar;
  13. $value = setBarValueByRef($bar->value, 1);
  14. } catch (Error $e) {
  15. echo $e->getMessage() . "\n";
  16. }
  17. var_dump(Foo::Bar->value);
  18. ?>
  19. --EXPECT--
  20. Cannot modify readonly property Foo::$value
  21. int(0)