#45760 [Opn->Bgs]: Notice: Undefined index "?:" operator

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45760
 Updated by:       [email protected]
-Summary:          Notice: Undefined index@"?:" operator
 Reported By:      s dot masugata at digicom dot dnp dot co dot jp
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Linux Debian(etch)
 PHP Version:      5.3CVS-2008-08-08 (snap)
 New Comment:

Hello, That behavior is expected. Coming soon it be documented.

Thanks.


Previous Comments:
------------------------------------------------------------------------

[2008-08-08 09:45:03] s dot masugata at digicom dot dnp dot co dot jp

Description:
------------
When "?:" operator is used, Notice should not be generated. 




Reproduce code:
---------------
<?php

error_reporting( E_ALL );
$user_id = $_GET['user_id'] ?: "anonymous";

echo $user_id.PHP_EOL;

?>



Expected result:
----------------
anonymous

Actual result:
--------------
Notice: Undefined index: user_id in /path/to/to/notice.php on line 4
anonymous



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45760&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.