#43282 [Opn]: call_user_func can't call non-static funcs statically

From: Date: Tue, 13 Nov 2007 23:50:32 +0000
Subject: #43282 [Opn]: call_user_func can't call non-static funcs statically
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119616@lists.php.net to get a copy of this message
 ID:               43282
 Updated by:       stas@php.net
 Reported By:      stas at zend dot com
 Status:           Open
 Bug Type:         Class/Object related
 Operating System: *
 PHP Version:      5.3CVS-2007-11-13 (CVS)
-Assigned To:      
+Assigned To:      jani
 New Comment:

I think it was recent change by Jani that broke it. 


Previous Comments:
------------------------------------------------------------------------

[2007-11-13 23:28:27] 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!


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43282&edit=1


Thread (3 messages)

« previous php.bugs (#119616) next »