#48714 [NEW]: When calling parent class method, self is responding

From: Date: Mon, 29 Jun 2009 09:17:57 +0000
Subject: #48714 [NEW]: When calling parent class method, self is responding
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138921@lists.php.net to get a copy of this message
From:             sebcorne at gmail dot com
Operating system: Windows
PHP version:      5.3.0RC4
PHP Bug Type:     Scripting Engine problem
Bug description:  When calling parent class method, self is responding

Description:
------------
Tested on php5.3.0-alpha3 (must be tested on last snap)

When calling parent class method, self is responding

(sorry for my bad english)

Reproduce code:
---------------
class base
{
	public function __call($name, $arguments)
	{
		echo get_called_class() . "->$name() is called \n\n";
	}
}


class A extends base
{
	public function parent_automatic()
	{
		$parentclass = get_parent_class($this);
		echo get_class($this) . '->'. __FUNCTION__ ."() call
$parentclass::test() \n";
		$parentclass::test();
	}
	
	public function parent_manual()
	{
		echo get_class($this) . '->'. __FUNCTION__ ."() call A::test() \n";
		A::test();
	}
}


class B extends A {}



$b = new B;
$b->parent_automatic();
$b->parent_manual();


Expected result:
----------------
B->parent_automatic() call A::test() 
A->test() is called 

B->parent_manual() call A::test() 
A->test() is called 


Actual result:
--------------
B->parent_automatic() call A::test() 
B->test() is called 

B->parent_manual() call A::test() 
B->test() is called 


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



Thread (7 messages)

« previous php.bugs (#138921) next »