From:             php at adaniels dot nl
Operating system: NB
PHP version:      5.0.3
PHP Bug Type:     *General Issues
Bug description:  is_callable will not handle private/public well from within a 
class

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 bug report at http://bugs.php.net/?id=33455&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33455&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33455&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33455&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33455&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33455&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33455&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33455&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33455&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33455&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33455&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33455&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33455&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33455&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33455&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33455&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33455&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33455&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33455&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33455&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33455&r=mysqlcfg

Reply via email to