Req #79669 [NEW]: Nullable variables
| From: | valentiny510 at gmail dot com | Date: | Wed, 03 Jun 2020 09:20:47 +0000 |
| Subject: | Req #79669 [NEW]: Nullable variables | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227283@lists.php.net to get a copy of this message | ||
From: valentiny510 at gmail dot com
Operating system: nix
PHP version: Next Major Version
Package: Variables related
Bug Type: Feature/Change Request
Bug description:Nullable variables
Description:
------------
The coalescing operator is one of the best life (or write) savers,
and still in some situations became a bit redundant, assuming $b is not
set...
$a = $b ?? null; meaning "if is null, null, else null"
And we have to do this only to avoid the errors flooding the log...
(yes, I know we can disable it with error_reporting, but that will also
disable other errors that we may want to see)
Another good thing is the nullable type, but sadly it only apply to...
types
So, my request is to extend the "nullable" to other... things,
like variables for instance, and I think will be a great life saver
Ex: $a = ?$b;
Seeing the above assignment, probably will be better to create a new
operator,
=?
Meaning of course, assign the right side if isset, otherwise null
Thank you
--
Edit bug report at https://bugs.php.net/bug.php?id=79669&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79669&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79669&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79669&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79669&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79669&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79669&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79669&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79669&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79669&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79669&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79669&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79669&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79669&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79669&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79669&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79669&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79669&r=mysqlcfg