objects_027.phpt 897 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Testing 'new static;' calling parent method
  3. --FILE--
  4. <?php
  5. class bar {
  6. public function show() {
  7. var_dump(new static);
  8. }
  9. }
  10. class foo extends bar {
  11. public function test() {
  12. parent::show();
  13. }
  14. }
  15. $foo = new foo;
  16. $foo->test();
  17. $foo::test();
  18. call_user_func(array($foo, 'test'));
  19. call_user_func(array('foo', 'test'));
  20. ?>
  21. --EXPECTF--
  22. object(foo)#%d (0) {
  23. }
  24. Strict Standards: Non-static method foo::test() should not be called statically in %s on line %d
  25. Strict Standards: Non-static method bar::show() should not be called statically in %s on line %d
  26. object(foo)#%d (0) {
  27. }
  28. object(foo)#%d (0) {
  29. }
  30. Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method foo::test() should not be called statically in %s on line %d
  31. Strict Standards: Non-static method bar::show() should not be called statically in %s on line %d
  32. object(foo)#%d (0) {
  33. }