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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: degaulle13 at virgilio dot it
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 13:01:32 2025 UTC