ID:               35540
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sam at ombwa dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Win2K
 PHP Version:      5CVS-2005-12-04 (snap)
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------

[2005-12-04 03:20:55] sam at ombwa dot com

Description:
------------
In an inherited function,
get_class()      gives the name of the parent class
get_class($this) gives the name of the child class.
These should be consistent and return the name of the child class.

Before you get deja vu and mark this bogus, I think that 31716 and
31616 were closed improperly as they deal with inheitance, NOT static
isuses like 30964/30140.

Reproduce code:
---------------
<?php
class Parentclass {
    function inherited_func() {
        echo "In inherited_func():\n__CLASS__ = " .     __CLASS__ .
"\nget_class() = " . get_class()      . "\nget_class(\$this) = " .
get_class($this) . "\n";
    }
}

class Childclass extends Parentclass {
    function func() {
        echo "In func():\n__CLASS__ = " . __CLASS__ . "\nget_class() =
" . get_class()      . "\nget_class(\$this) = " . get_class($this) .
"\n";
    }
}
$c = new Childclass();
echo "<pre> phpversion()=" . phpversion() . "\n";
$c->func();
$c->inherited_func();
?>

Expected result:
----------------
I expect get_class() and get_class($this) to return "Childclass".

Actual result:
--------------
 phpversion()=5.1.2-dev
In func():
__CLASS__ = Childclass
get_class() = Childclass
get_class($this) = Childclass
In inherited_func():
__CLASS__ = Parentclass
get_class() = Parentclass
get_class($this) = Childclass


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35540&edit=1

Reply via email to