php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #41729 Cap.12 Variables - Basic
Submitted: 2007-06-18 15:06 UTC Modified: 2007-08-16 14:22 UTC
From: degaulle13 at virgilio dot it Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows XP Pro SP2
Private report: No CVE-ID: None
 [2007-06-18 15:06 UTC] degaulle13 at virgilio dot it
Description:
------------
I am an Italian, excused for errors in the translation.

In the Documentation -> Cap.12 Variables -> Basic is written: 

"One important thing to note is that only named variables may be assigned by reference."

<?php
...
error_reporting(E_ALL);
function test()
{
   return 25;
}
$bar = &test();    // Invalid.
?>  

But to me, this code works. In fact, if I insert the row "error_reporting(E_ALL);" they give to a Notice but not an error to me.

Output:
Notice: Only variables should be assigned by reference in C:\www\index.php on line 9
25 

Hello.



Reproduce code:
---------------
<?php
...
error_reporting(E_ALL);
function test()
{
   return 25;
}
$bar = &test();    // Invalid.
?>  


Expected result:
----------------
Parse Error....

Actual result:
--------------
Notice: Only variables should be assigned by reference in C:\www\index.php on line 9
25 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-16 14:22 UTC] vrana@php.net
The code is wrong even if it issues only E_NOTICE.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 16:01:31 2024 UTC