Bugs php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login

go to bug id or search bugs for

Request #53356 Allow use function return value in write context
Submitted: 2010年11月19日 15:50 UTC Modified: 2015年04月06日 09:30 UTC
Votes:2
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lifinsky at yandex dot ru
New email:
PHP Version: OS:

[2010年11月19日 15:50 UTC] lifinsky at yandex dot ru
Description:
------------
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;
}
print(++test());
print(++test());
print(++test());
Expected result:
----------------
123
Actual result:
--------------
Fatal error

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
[2015年03月27日 14:24 UTC] tyrael@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: tyrael
[2015年03月27日 14:24 UTC] tyrael@php.net
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
http://snaps.php.net/.
 For Windows:
http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.
this will be supported in php7 as you can see here: http://3v4l.org/lCOIR
[2015年03月27日 14:30 UTC] nikic@php.net
-Status: Closed +Status: Re-Opened
[2015年03月27日 14:30 UTC] nikic@php.net
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年03月27日 15:43 UTC] nikic@php.net
Reverted to previous behavior in https://github.com/php/php-src/commit/c64f5e333269caf0bb0d67a06f8372cc47e249bf.
[2015年04月06日 09:30 UTC] tyrael@php.net
-Assigned To: tyrael +Assigned To:
PHP Copyright © 2001-2025 The PHP Group
All rights reserved. Last updated: Thu Oct 16 17:00:01 2025 UTC

AltStyle によって変換されたページ (->オリジナル) /