Edit report at https://bugs.php.net/bug.php?id=64406&edit=1
ID: 64406 Updated by: ni...@php.net Reported by: me at felixcarmona dot com Summary: Protected method is called when i try to access to publicproperty with samename -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Linux PHP Version: 5.4Git-2013-03-11 (snap) Block user comment: N Private report: N New Comment: test() is the constructor in your case (as the class is called "Test"). You get the error when the object is constructed, not when accessing the property ;) Previous Comments: ------------------------------------------------------------------------ [2013-03-11 14:17:42] me at felixcarmona dot com Description: ------------ When i have a public property and private/protected method with the same name, i can't access to the property, because the method is called. I'm using ->name; and NOT ->name(); Test script: --------------- <?php class Test { public $test = 5; protected function test() { return 6; } } $test = new Test(); echo $test->test; Expected result: ---------------- 5 Actual result: -------------- Fatal error: Call to protected Test::test() from invalid context ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64406&edit=1