From:             
Operating system: Any
PHP version:      5.3.2
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Lambda's definition breaks references when using use() clause.

Description:
------------
See test script.

Test script:
---------------
[...]# cat test.php

<?php



$x =null;



// reference $x

$y =&$x;



// focus on this (lambda def.)

function() use( $y){};



// update value of $x via reference.

$y =10;



// oops, bug, outputs NULL since lambda def. breaks

//  the reference.

var_dump( $x);



?>



[...]# php -v

PHP 5.3.2 (cli) (built: Mar  4 2010 22:12:20)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies



[...]# php test.php

NULL

Expected result:
----------------
int(10)

Actual result:
--------------
NULL

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

Reply via email to