#41542 [Bgs]: The '@' operator changes the behaviour of the code
| From: | linfo2003 at libero dot it | Date: | Wed, 30 May 2007 16:33:20 +0000 |
| Subject: | #41542 [Bgs]: The '@' operator changes the behaviour of the code | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113210@lists.php.net to get a copy of this message | ||
ID: 41542
User updated by: linfo2003 at libero dot it
Reported By: linfo2003 at libero dot it
Status: Bogus
Bug Type: Variables related
Operating System: WindowsXP
PHP Version: 5.2.2
New Comment:
You're totally right.
I thought it was raised a fatal error, not just a strict message, when
passing an expression instead of a variable where a variabile reference
is expected, so I hadn't used E_STRICT.
Thank you very much!
Previous Comments:
------------------------------------------------------------------------
[2007-05-30 16:10:32] tony2001@php.net
>But AFAIK, only *variables* can be passed by reference.
Exactly. Add E_STRICT to the error level and you'll see a message about
it.
------------------------------------------------------------------------
[2007-05-30 16:06:22] linfo2003 at libero dot it
But AFAIK, only *variables* can be passed by reference.
However, if you say it's a normal behaviour, I'll trust you.
Thank you for your courtesy.
------------------------------------------------------------------------
[2007-05-30 16:00:26] tony2001@php.net
@$var is not a variable, it's an expression.
So you end up passing result of this expression to the function, not
the variable itself.
------------------------------------------------------------------------
[2007-05-30 15:43:01] linfo2003 at libero dot it
Then it's the $third case that is wrong.
byRef(@$third['undefined']) does NOT creates that index.
Should the '@' operator only suppress the notice?
Then that index should be added to the $third array.
It isn't added.
Is this a normal behaviour?
Thanks.
------------------------------------------------------------------------
[2007-05-30 15:38:36] tony2001@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
Passing a variable by reference is expected to create it.
------------------------------------------------------------------------
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/41542
--
Edit this bug report at http://bugs.php.net/?id=41542&edit=1