bug21888.phpt 582 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #21888 (protected property and protected method of the same name)
  3. --SKIPIF--
  4. <?php
  5. if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed');
  6. ?>
  7. --FILE--
  8. <?php
  9. class mom {
  10. protected $prot = "protected property\n";
  11. protected function prot() {
  12. print "protected method\n";
  13. }
  14. }
  15. class child extends mom {
  16. public function callMom() {
  17. $this->prot();
  18. }
  19. public function viewMom() {
  20. print $this->prot;
  21. }
  22. }
  23. $c = new child();
  24. $c->callMom();
  25. $c->viewMom();
  26. ?>
  27. --EXPECT--
  28. protected method
  29. protected property