php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43282 call_user_func can't call non-static funcs statically
Submitted: 2007-11-13 23:28 UTC Modified: 2009-08-07 19:42 UTC
From: stas at zend dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3CVS-2007-11-13 (CVS) OS: *
Private report: No CVE-ID: None
 [2007-11-13 23:28 UTC] stas at zend dot com
Description:
------------
When call_user_func is given callback array with class name as string, it refuses to call non-static functions, even though PHP can call it with just E_STRICT.

Reproduce code:
---------------
<?php
class Foo {
        function bar() { echo "OK!"; }
}
call_user_func(array("Foo", "bar"), 123);
Foo::bar(123);


Expected result:
----------------
OK!OK!

Actual result:
--------------
Warning: call_user_func() expects parameter 1 to be valid callback, array given in t.php on line 5
OK!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-13 23:50 UTC] stas@php.net
I think it was recent change by Jani that broke it. 
 [2007-11-14 01:27 UTC] johannes@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

it's the same issue like #43231
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 08:01:29 2024 UTC