#37270 [Bgs]: incompatibility 4.4.2 vs. 5.1.3 ?
| From: | mike@php.net | Date: | Wed, 03 May 2006 06:57:24 +0000 |
| Subject: | #37270 [Bgs]: incompatibility 4.4.2 vs. 5.1.3 ? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96512@lists.php.net to get a copy of this message | ||
ID: 37270
Updated by: mike@php.net
Reported By: lacak at users dot sourceforge dot net
Status: Bogus
Bug Type: *General Issues
Operating System: Windows 98
PHP Version: 5.1.3
New Comment:
It will cause memory corruptions.
Yes, I know it's unfortunate, but ATM it's not fixable.
Previous Comments:
------------------------------------------------------------------------
[2006-05-03 05:23:51] lacak at users dot sourceforge dot net
Yes I understand, that $v=0 in f($v=0) is expression in POV of php, but
in POV of user it is :
1. initializing variable
2. passing this variable as by reference argument to function
And second, why this produces no error message (no warning, no notice;
error_reporting=E_ALL) under 4.4.2 and works it as expected ?
This seems to me like regression problem between 4.4 -> 5.1 ?
------------------------------------------------------------------------
[2006-05-02 07:10:33] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Turn on error displaying and you'll see "only variables can be passed
by reference". "$v=..." as function argument is an expression.
Please use a support channel in future.
------------------------------------------------------------------------
[2006-05-02 06:43:38] lacak at users dot sourceforge dot net
Description:
------------
See please the php reproduce code.
In PHP 4.4.2 returns "Expected result"
In PHP 5.1.3 returns "Actual result"
Reproduce code:
---------------
<?php
function a(&$p) {
$p=array("a"=>"1", "b"=>2);
}
function b(&$p) {
$p=1;
}
a($v1=array());
print_r($v1);
b($v2=0);
var_dump($v2);
?>
Expected result:
----------------
Array ( [a] => 1 [b] => 2 ) int(1)
Actual result:
--------------
Array ( ) int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37270&edit=1