php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45180 'class::method' works differently than array('class', 'method')
Submitted: 2008-06-04 18:30 UTC Modified: 2008-06-05 18:52 UTC
From: felipe@php.net Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-06-04 (CVS) OS:
Private report: No CVE-ID: None
 [2008-06-04 18:30 UTC] felipe@php.net
Description:
------------
See the code below.

Reproduce code:
---------------
<?php

class foo {
	public function test() {
		call_user_func(array('FOO', 'ABC'));
		call_user_func(array($this, 'ABC'));
		call_user_func('FOO::ABC');
	}
	function __call($a, $b) {
		print "__call:\n";
		var_dump($a);
	}
	static public function __callStatic($a, $b) {
		print "__callstatic:\n";
		var_dump($a);
	}
}

$x = new foo;

$x->test();


Expected result:
----------------
__call:
string(3) "ABC"
__call:
string(3) "ABC"
__call:
string(3) "ABC"

Actual result:
--------------
__call:
string(3) "ABC"
__call:
string(3) "ABC"

Fatal error: Non-static method foo::ABC() cannot be called statically in ...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-05 18:52 UTC] felipe@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC