Bug #80945 [NEW]: "Notice: Undefined index" on unset() ArrayObject non-existing key

From: Date: Fri, 09 Apr 2021 14:04:38 +0000
Subject: Bug #80945 [NEW]: "Notice: Undefined index" on unset() ArrayObject non-existing key
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233343@lists.php.net to get a copy of this message
From:             php at yopmail dot com
Operating system: 
PHP version:      7.4.16
Package:          SPL related
Bug Type:         Bug
Bug description:"Notice: Undefined index" on unset() ArrayObject non-existing key

Description:
------------
Unsetting a non-existing key on an ArrayObject triggers a notice (even a
warning in PHP 8),
while it doesn't on an array.

More complete example: https://3v4l.org/WVJnf

Test script:
---------------
<?php

$arr = array();
unset($arr['nonexisting_1']);

$obj = new ArrayObject();
unset($obj['nonexisting_2']);

Expected result:
----------------
(nothing)

Actual result:
--------------
Notice: Undefined index: nonexisting_2 in [...] on line 7

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


Thread (3 messages)

« previous php.bugs (#233343) next »