|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-01 07:07 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2021-07-01 07:07 UTC] nikic@php.net
[2021-07-01 07:20 UTC] su at zorzz dot com
[2021-07-01 07:26 UTC] requinix@php.net
[2021-07-01 07:55 UTC] su at zorzz dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 03:00:01 2025 UTC |
Description: ------------ Null Coalescing Operator throw a notice when key is a numeric string, just like "10-10" or "123b". Test script: --------------- <?php error_reporting(E_ALL); date_default_timezone_set("Asia/Shanghai"); $context = ['attributes' => 'config']; // example1 var_dump($context['attributes']['10-10'][':type'] ?? null); // the same as example1 var_dump(isset($context['attributes']['10-10'][':type']) ? $context['attributes']['10-10'][':type'] : null); Expected result: ---------------- NULL NULL // Isset function and [Null Coalescing Operator] should not throw exceptions. Actual result: -------------- Notice: A non well formed numeric value encountered in /home/zorzz/index.php on line 8 NULL Notice: A non well formed numeric value encountered in /home/zorzz/index.php on line 9 NULL