#35995 [Asn->Bgs]: Problems defining vars in arguments
| From: | dmitry@php.net | Date: | Mon, 16 Jan 2006 10:23:41 +0000 |
| Subject: | #35995 [Asn->Bgs]: Problems defining vars in arguments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91995@lists.php.net to get a copy of this message | ||
ID: 35995
Updated by: dmitry@php.net
Reported By: jadelucca at comcast dot net
-Status: Assigned
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.1.2
Assigned To: dmitry
New Comment:
The following code shouldn't be worked according to language
specification, but worked before 5.1 because of side effect
<?php
function test(&$text) {
$text = "Prefix " . $text;
}
test($x="A");
echo $x;
?>
However the following code never worked
<?php
function test(&$text) {
$text = "Prefix " . $text;
}
$y="A";
test($x=$y);
echo $x;
?>
I think we shouldn't keep such mess for BC and break language
specification (the assignment $x="A" in first example is an expression
and it can not be passed by reference).
Previous Comments:
------------------------------------------------------------------------
[2006-01-15 22:16:32] derick@php.net
Jani, I discussed this with Ilia earlier today and it *is* a BC
breaking change in PHP 5.1.2 - all other versions do not do this
(including PHP 4.4.x or 5.1.1). Therefore it is a bug and it should be
addressed. Dmitry, if you feel otherwise, please close it then.
------------------------------------------------------------------------
[2006-01-15 19:56:24] sniper@php.net
And you've reported it as PHP 5.1.2 bug which it STILL IS NOT.
Please stop reopening this, we're not gonna change it.
------------------------------------------------------------------------
[2006-01-15 19:26:55] jadelucca at comcast dot net
iliaa, did you read Derick's post? You're right; it's NOT a bug, in
5.1.2, that is. It is a bug in the 4.4.x version that it works in the
first place without issuing errors.
------------------------------------------------------------------------
[2006-01-14 21:47:46] jadelucca at comcast dot net
Thank you Derrick! I really appreciate your help. I will change my code
not to do this... I thought you could since it issued no errors.
------------------------------------------------------------------------
[2006-01-14 19:59:58] derick@php.net
It's not a bug in 5.1.2, but in earlier versions. PHP 4.4 still inhbits
this bug though, in the form that it doesn't give an E_STRICT error.
Dmitry, can you have a look at that?
------------------------------------------------------------------------
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/35995
--
Edit this bug report at http://bugs.php.net/?id=35995&edit=1