objects_029.phpt 497 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Trying to access undeclared static property
  3. --FILE--
  4. <?php
  5. class bar {
  6. public function __set($a, $b) {
  7. print "hello\n";
  8. }
  9. }
  10. class foo extends bar {
  11. public function __construct() {
  12. static::$f = 1;
  13. }
  14. public function __set($a, $b) {
  15. print "foo\n";
  16. }
  17. }
  18. new foo;
  19. ?>
  20. --EXPECTF--
  21. Fatal error: Uncaught Error: Access to undeclared static property foo::$f in %s:%d
  22. Stack trace:
  23. #0 %s(%d): foo->__construct()
  24. #1 {main}
  25. thrown in %s on line %d