Bug #81212 [NEW]: Throws a Notice exception when the [Null Coalescing Operator] detects an array

From: Date: Thu, 01 Jul 2021 06:22:14 +0000
Subject: Bug #81212 [NEW]: Throws a Notice exception when the [Null Coalescing Operator] detects an array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234715@lists.php.net to get a copy of this message
From:             su at zorzz dot com
Operating system: linux(CentOS7.2)
PHP version:      7.3.28
Package:          *General Issues
Bug Type:         Bug
Bug description:Throws a Notice exception when the [Null Coalescing Operator] detects an array

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81212&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81212&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81212&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81212&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81212&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81212&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81212&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81212&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81212&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81212&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81212&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81212&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81212&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81212&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81212&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81212&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81212&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81212&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#234715) next »