bug21888.phpt 461 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Bug #21888 (protected property and protected method of the same name)
  3. --FILE--
  4. <?php
  5. class mom {
  6. protected $prot = "protected property\n";
  7. protected function prot() {
  8. print "protected method\n";
  9. }
  10. }
  11. class child extends mom {
  12. public function callMom() {
  13. $this->prot();
  14. }
  15. public function viewMom() {
  16. print $this->prot;
  17. }
  18. }
  19. $c = new child();
  20. $c->callMom();
  21. $c->viewMom();
  22. ?>
  23. --EXPECT--
  24. protected method
  25. protected property