From:             hanskrentel at yahoo dot de
Operating system: Multiple
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Bug
Bug description:Variable Aliasing does not work in Closure

Description:
------------
It's not possible to make use of variable aliasing in PHP when the alias is
used 
within the use clause of a lambda function construct that is assigned to
that 
variable (recursion).

PHP denies to do what it is commanded with a Fatal error: Cannot destroy
active 
lambda function. But the function is not destroyed. It's just not that the

variable container contains the identifier of it.

I'd like to change that, and I don't want to waste another variable name.
Also I 
don't understand how I can actually destroy something I should not have any

access 
to from PHP userland.

Or if that is intended, please allow us to destroy the active lambda making
the 
function return NULL and continue to execute.



Test script:
---------------
$f = function() use (&$f) {
    $f = function() {echo "hello"};
};
$f();
$f();


Expected result:
----------------
hello

Actual result:
--------------
Fatal error: Cannot destroy active lambda function 

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

Reply via email to