bug52484_2.phpt 394 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #52484.2 (__set() ignores setting properties with empty names)
  3. --FILE--
  4. <?php
  5. class A {
  6. function __set($prop, $val) {
  7. $this->$prop = $val;
  8. }
  9. }
  10. $a = new A();
  11. $prop = "\0";
  12. $a->$prop = 2;
  13. ?>
  14. --EXPECTF--
  15. Fatal error: Uncaught Error: Cannot access property starting with "\0" in %s:%d
  16. Stack trace:
  17. #0 %s(%d): A->__set('\x00', 2)
  18. #1 {main}
  19. thrown in %s on line %d