Req #53356 [ReO]: Allow use function return value in write context

From: Date: Fri, 27 Mar 2015 15:43:22 +0000
Subject: Req #53356 [ReO]: Allow use function return value in write context
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191650@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53356&edit=1

 ID:                 53356
 Updated by:         nikic@php.net
 Reported by:        lifinsky at yandex dot ru
 Summary:            Allow use function return value in write context
 Status:             Re-Opened
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 PHP Version:        5.3.3
 Assigned To:        tyrael
 Block user comment: N
 Private report:     N

 New Comment:

Reverted to previous behavior in https://github.com/php/php-src/commit/c64f5e333269caf0bb0d67a06f8372cc47e249bf.


Previous Comments:
------------------------------------------------------------------------
[2015-03-27 14:30:02] 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 14:24:12] 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

------------------------------------------------------------------------
[2010-11-19 15:50:18] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=53356&edit=1


Thread (4 messages)

« previous php.bugs (#191650) next »