From:             dormam at gmail dot com
Operating system: Ubuntu Jaunty
PHP version:      5.3.0
PHP Bug Type:     Feature/Change Request
Bug description:  Fatal error "Function must be a string" message should be 
renamed.

Description:
------------
In the past, to call a variable as a function, the variable had to be a
string: $var = 'strlen'; $var(/*args*/); calls strlen.

But in the present, the message is a bit misleading, since it must not
necessarily be a string: $foo = function() {echo "bar";};

I consider this to be a very minor thing, but consider the message wrong,
anyway.

Reproduce code:
---------------
function badLambdaCreator($argument) {
    function($test) use ($argument) { 
        /*Do something*/
    };
    /*No return given :O*/
}
$foo = badLambdaCreator(10);
$foo(50); 
//Fatal error telling you to use strings, 
//while a lambda is fine too.

Expected result:
----------------
A fatal error that also includes lambdas (I guess callbacks work? I'm not
sure what name is the most appropiate).

Actual result:
--------------
An error that tells you that **ONLY** strings can be used.

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

Reply via email to