From:             [EMAIL PROTECTED]
Operating system: 
PHP version:      6CVS-2007-11-26 (snap)
PHP Bug Type:     *General Issues
Bug description:  get_called_class not working as expected

Description:
------------
The Function get_called_class works not as expected.
the new introduced static call works correct, the self call too but if you
call the demo class with parent you dont get foo as result. This should be
so because its not possible to overwrite a existing class in a  static
class with late static binding.

get_called_class() should return in every call 'foo' and not as shown with
parent::demo() a 'bar'



Reproduce code:
---------------
<?php
abstract class bar
{
    public static function demo()
    {
        var_dump(get_called_class());
    }
}

class foo extends bar
{
    public static function parent_demo()
    {
        parent::demo();
    }
    public static function self_demo()
    {
        self::demo();
    }
    public static function static_demo()
    {
        static::demo();
    }
}

echo 'bar::demo()' . PHP_EOL;
bar::demo();
echo 'foo::demo()' . PHP_EOL;
foo::demo();
echo 'foo::parent_demo()' . PHP_EOL;
foo::parent_demo();
echo 'foo::self_demo()' . PHP_EOL;
foo::self_demo();
echo 'foo::static_demo()' . PHP_EOL;
foo::static_demo();


?>

Expected result:
----------------
bar::demo()
string(3) "bar"
foo::demo()
string(3) "foo"
foo::parent_demo()
string(3) "bar"
foo::self_demo()
string(3) "foo"
foo::static_demo()
string(3) "foo"

Actual result:
--------------
bar::demo()
string(3) "bar"
foo::demo()
string(3) "foo"
foo::parent_demo()
string(3) "foo"
foo::self_demo()
string(3) "foo"
foo::static_demo()
string(3) "foo"

-- 
Edit bug report at http://bugs.php.net/?id=43408&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43408&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43408&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43408&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43408&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43408&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43408&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43408&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43408&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43408&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43408&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43408&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43408&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43408&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43408&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43408&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43408&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43408&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43408&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43408&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43408&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43408&r=mysqlcfg

Reply via email to