Req #53826 [NEW]: __callStatic fired in base class through a parent call if the method is private

From: Date: Mon, 24 Jan 2011 00:24:19 +0000
Subject: Req #53826 [NEW]: __callStatic fired in base class through a parent call if the method is private
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158123@lists.php.net to get a copy of this message
From:             
Operating system: 
PHP version:      5.3.5
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:__callStatic fired in base class through a parent call if the method is private

Description:
------------
In a base class, a private non static method called by an extended class
with 
parent:: 
triggers __callStatic, while __call could have been expected.

If this private method is not defined at all, __call is triggered. (which
seems 
right according to http://bugs.php.net/bug.php?id=52713 )

The same behaviour for both cases should be suitable.

Test script:
---------------
class A1 {
	public function __call($method, $args) { echo "__call";	}
	public static function __callStatic($method, $args) { echo "__callStatic";
}
}

class A2 { // A1 with private function test
	public function __call($method, $args) { echo "__call";	}
	public static function __callStatic($method, $args) { echo "__callStatic";
}	
	private function test() {}
}

class B1 extends A1 {
	public function test(){	parent::test();	}
}

class B2 extends A2 {
	public function test(){	parent::test();	}
}

$test1 = new B1;
$test2 = new B2;
$test1->test();
$test2->test();

Expected result:
----------------
__call__call

// or __callStatic__callStatic, but the same behaviour for both

Actual result:
--------------
__call__callStatic


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



Thread (2 messages)

« previous php.bugs (#158123) next »