php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43785 the puzzling References Design
Submitted: 2008-01-08 09:26 UTC Modified: 2008-01-12 15:34 UTC
Votes:2
Avg. Score:2.5 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: hackfan at vip dot sina dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2008-01-08 09:26 UTC] hackfan at vip dot sina dot com
Description:
------------
When I use referenes to an unvalued var, I found it valued to NULL and there isn't a notice printed.

Then I'd like to ask: what is notice designed for?

Reproduce code:
---------------
<?php
error_reporting(E_ALL);

$b = &$a;
$a++;
echo $a;

?>

Expected result:
----------------
PHP Notice:  Undefined variable: a in E:\a.php on line 4
1

Actual result:
--------------
1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-08 10:00 UTC] hackfan at vip dot sina dot com
<?php
error_reporting(E_ALL);

$b = &$a;

if( isset($a) === false )
{
        $a++;
        echo $a;
}
else
{
        echo 'Hello';
}
?>

print:

1
 [2008-01-12 15:34 UTC] tony2001@php.net
There is no notice so that you could pass variables by reference with no need to declare them before.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 21:01:26 2024 UTC