Req #49016 [Opn->Wfx]: Remove notice error on ?: (undefined index)
| From: | jani@php.net | Date: | Wed, 24 Nov 2010 14:32:02 +0000 |
| Subject: | Req #49016 [Opn->Wfx]: Remove notice error on ?: (undefined index) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156399@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=49016&edit=1
ID: 49016
Updated by: jani@php.net
Reported by: ivan1986 at list dot ru
Summary: Remove notice error on ?: (undefined index)
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.0
Block user comment: N
Private report: N
New Comment:
For reasoning on the notice:
http://markmail.org/message/ivexk3smqa2kfipq
Conclusion: It will stay.
Previous Comments:
------------------------------------------------------------------------
[2009-07-22 13:50:32] ivan1986 at list dot ru
Description:
------------
When using undefined variable in ?: php generate notice
in php 5.2.x very often use this code
$inp = isset($_POST['inp']) ? $_POST['inp'] : 'def_inp';
in php 5.3 want use a shorter code
$inp = $_POST['inp'] ?: 'def_inp';
Reproduce code:
---------------
<?php
$inp = $_POST['inp'] ?: 'def_inp';
echo $inp;
?>
Expected result:
----------------
def_inp
Actual result:
--------------
Notice: Undefined index: inp in /path/to/to/index.php on line 3
def_inp
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=49016&edit=1