php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36011 Strict errormsg wrong for call_user_func() and the likes
Submitted: 2006-01-14 15:42 UTC Modified: 2006-01-14 16:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: phpbugreport at elexer dot com Assigned: helly (profile)
Status: Closed Package: Class/Object related
PHP Version: 5CVS-2006-01-14 (snap) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phpbugreport at elexer dot com
New email:
PHP Version: OS:

 

 [2006-01-14 15:42 UTC] phpbugreport at elexer dot com
Description:
------------
With error_reporting(E_ALL | E_STRICT) and usage of call_user_func(), array_map() on a static function returns "Strict Standards: Non-static method TestClass::test() cannot be called statically, assuming $this from compatible context TestClass" while the called method is static.

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

error_reporting(E_ALL | E_STRICT);

class TestClass {
	static function test() {
		echo "test() called\r\n";
	}
	
	function whee() {
		array_map(array('TestClass', 'test'), array('array_value'));
	}

	function whee4() {
		call_user_func( Array('TestClass', 'test') );
	}

	static function whee5() {
		call_user_func( Array('TestClass', 'test') );
	}
}


TestClass::test();

$a = new TestClass();
$a->whee();
$a->whee4();
$a->whee5();
TestClass::whee5();

Expected result:
----------------
No strict warnings

Actual result:
--------------
Strict Standards: Non-static method TestClass::test() cannot be called statically, assuming $this from compatible context TestClass in test2.php on line 11 test() called

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-14 16:24 UTC] helly@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: Thu Nov 21 12:01:29 2024 UTC