|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53356 Allow use function return value in write context
Submitted: 2010-11-19 15:50 UTC Modified: 2015-04-06 09:30 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: lifinsky at yandex dot ru Assigned:
Status: Re-Opened Package: Scripting Engine problem
PHP Version: 5.3.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
42 - 12 = ?
Subscribe to this entry?

 [2010-11-19 15:50 UTC] lifinsky at yandex dot ru
Allow use function return value in write context if this function return value by reference (Such as c or c++)

Test script:
function &test() {
	static $a = 0;
	return $a;


Expected result:

Actual result:
Fatal error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-27 14:24 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: tyrael
 [2015-03-27 14:24 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

this will be supported in php7 as you can see here:
 [2015-03-27 14:30 UTC]
-Status: Closed +Status: Re-Opened
 [2015-03-27 14:30 UTC]
That change was not intentional and we may want to revert it. Especially given how it currently allows you to write this even if the function does not return by reference.
 [2015-04-06 09:30 UTC]
-Assigned To: tyrael +Assigned To:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 01:01:31 2024 UTC