#33558 [Opn->Bgs]: warning with nested calls to functions returning by reference
| From: | derick@php.net | Date: | Sun, 03 Jul 2005 21:08:40 +0000 |
| Subject: | #33558 [Opn->Bgs]: warning with nested calls to functions returning by reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81331@lists.php.net to get a copy of this message | ||
ID: 33558
Updated by: derick@php.net
Reported By: l dot alberton at quipo dot it
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Irrelevant
PHP Version: 4.4.0RC1
New Comment:
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
You can only return variable by reference, not function's results.
(This never worked correctly before anyway, now you just get a nice
notice about it so that you can fix your code).
Previous Comments:
------------------------------------------------------------------------
[2005-07-03 23:04:47] l dot alberton at quipo dot it
Description:
------------
When a function which returns a reference calls another function which
returns a reference, the engine complains because the outer function
does not return a variable reference.
It happens with PHP4.4.0RC2 too.
Reproduce code:
---------------
<?php
function & foo() {
$var = 'a';
return $var;
}
function & bar() {
return foo();
}
$a =& bar();
?>
Expected result:
----------------
no NOTICEs
Actual result:
--------------
Notice: Only variable references should be returned by reference in
test_ref.php on line 8
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33558&edit=1