Doc #80040 [NEW]: Null coalescing operator ignores notices and warnings
| From: | skeeman at inbox dot ru | Date: | Mon, 31 Aug 2020 13:20:05 +0000 |
| Subject: | Doc #80040 [NEW]: Null coalescing operator ignores notices and warnings | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17842@lists.php.net to get a copy of this message | ||
From: skeeman at inbox dot ru
Operating system: Ubuntu 18.04
PHP version: 7.4.9
Package: Compile Warning
Bug Type: Documentation Problem
Bug description:Null coalescing operator ignores notices and warnings
Description:
------------
---
From manual page: https://php.net/migration70.new-features
---
I really don't know - is this a bug or a feature? Is this a safe
behavior? Can I count on this behavior and use it in the future?
Thank you for your answer!
Test script:
---------------
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
class A {
public function test()
{
return [];
}
}
$obj = new A();
$result = $obj->test()[0] ?? null;
var_dump($result);
Expected result:
----------------
PHP Notice: Undefined offset: 0 in /directory/file on line 15
Actual result:
--------------
NULL
--
Edit bug report at https://bugs.php.net/bug.php?id=80040&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80040&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80040&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80040&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80040&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80040&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80040&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80040&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80040&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80040&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80040&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80040&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80040&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80040&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80040&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80040&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80040&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80040&r=mysqlcfg