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:
*ALWAYS* try latest snapshots before reporting a bug.
This was fixed long time ago.
Btw, 5.0.3 is not even the latest version.
Previous Comments:
------------------------------------------------------------------------
[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