ID: 33455 Updated by: [EMAIL PROTECTED] Reported By: php at adaniels dot nl -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: NB PHP Version: 5.0.3 New Comment:
Yes, I'm sure. And could try latest snapshot and see it yourself. Previous Comments: ------------------------------------------------------------------------ [2005-06-24 09:26:39] php at adaniels dot nl Please comment.... ------------------------------------------------------------------------ [2005-06-24 01:48:38] php at adaniels dot nl Are you sure? I did not see this bug in the bug reports. Please do not confuse this bug with Bug #29210 'Function: is_callable - no support for private and protected classes': http://bugs.php.net/bug.php?id=29210 Function is_callable does work correctly for private methode's from outside the object, as is done in bug 29210. But is doest not work correctly when using $this within the class as is done in this report. PS. I use ZendStudio for development. The latest version of ZendStudio is bundeled with PHP 5.0.3. That's why I did not test this under 5.0.4 ------------------------------------------------------------------------ [2005-06-23 23:08:11] [EMAIL PROTECTED] *ALWAYS* try latest snapshots before reporting a bug. This was fixed long time ago. Btw, 5.0.3 is not even the latest version. ------------------------------------------------------------------------ [2005-06-23 22:28:05] php at adaniels dot nl Description: ------------ Function is_callable will not handle private/public well from within a class. Reproduce code: --------------- <?php class X { private function getXX($value) { return "XX $value"; } function testXX() { echo (is_callable(array($this, 'getXX')) ? $this->getXX("test") : "Can't call getXX within " . __CLASS__) . "\n"; } } class Y extends X { function testXX() { echo (is_callable(array($this, 'getXX')) ? $this->getXX("test") : "Can't call getXX within " . __CLASS__) . "\n"; } } $x = new X; echo (is_callable($x, 'getXX') ? $x->getXX("test") : "Can't call getXX outside for " . get_class($x)) . "\n"; $x->testXX(); $y = new y; echo (is_callable($y, 'getXX') ? $y->getXX("test") : "Can't call getXX outside for " . get_class($y)) . "\n"; $y->testXX(); ?> Expected result: ---------------- Can't call getXX outside for X XX test Can't call getXX outside for Y Can't call getXX within Y Actual result: -------------- Can't call getXX outside for X XX test Can't call getXX outside for Y <br /> <b>Fatal error</b>: Call to private method X::getXX() from context 'Y' in <b>\\Seabert\webroot\ontwikkeling\quickbuild\test.php</b> on line <b>76</b><br /> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33455&edit=1