Bug #54039 [Asn->Csd]: use() of static variables in lambda functions can break staticness
| From: | dmitry@php.net | Date: | Fri, 08 Apr 2011 10:03:21 +0000 |
| Subject: | Bug #54039 [Asn->Csd]: use() of static variables in lambda functions can break staticness | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160025@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54039&edit=1
ID: 54039
Updated by: dmitry@php.net
Reported by: a at b dot c dot de
Summary: use() of static variables in lambda functions can
break staticness
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.5
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-04-08 12:02:10] dmitry@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=310050
Log: - Fixed bug #54358 (Closure, use and reference)
- Fixed bug #54039 (use() of static variables in lambda functions can
break staticness)
------------------------------------------------------------------------
[2011-02-21 08:34:59] cataphract@php.net
The concatenation example indeed shows memory corruption, with invalid
free's and reads of freed data,
------------------------------------------------------------------------
[2011-02-19 03:29:30] a at b dot c dot de
The cited snapshot (the VC6 build, FYI) shows the correct behaviour for
the incrementing tests.
$v remains static in the string concatenation test as well, but there is
what is probably an additional issue at play there:
Outer function catenates 'b' onto $v to give b
Outer function catenates 'a' onto $v to give ba
Inner function reckons $v is b
Outer function catenates 'b' onto $v to give bab
Outer function catenates 'a' onto $v to give baba
Inner function reckons $v is Xâ¼â
Outer function catenates 'b' onto $v to give Xâ¼ââºb
Outer function catenates 'a' onto $v to give Xâ¼ââºba
Inner function reckons $v is âââºb
Outer function catenates 'b' onto $v to give âââºbab
Outer function catenates 'a' onto $v to give âââºbaba
Inner function reckons $v is âââºbab
------------------------------------------------------------------------
[2011-02-18 13:59:28] cataphract@php.net
For windows, the address will be
http://rmtools.php.net/snaps/5.3-ts-windows-vc9-x86/builds/php-5.3-ts-windows-vc9-x86-r308443.zip
(or similar for other compiler/thread safety combination)
------------------------------------------------------------------------
[2011-02-18 13:54:23] cataphract@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Bug #53958 is similar and is fixed in SVN.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=54039
--
Edit this bug report at http://bugs.php.net/bug.php?id=54039&edit=1