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

From: Date: Wed, 05 May 2021 14:35:52 +0000
Subject: Bug->Doc #80945 [Opn]: "Notice: Undefined index" on unset() ArrayObject non-existing key
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18748@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80945&edit=1 ID: 80945 Updated by: cmb@php.net Reported by: php at yopmail dot com Summary: "Notice: Undefined index" on unset() ArrayObject non-existing key Status: Open -Type: Bug +Type: Documentation Problem Package: SPL related PHP Version: 7.4.16 Block user comment: N Private report: N New Comment: These notices/warnings look intentional[1]. Changing to doc issue. [1] <https://github.com/php/php-src/blob/php-7.4.19/ext/spl/spl_array.c#L544-L602> Previous Comments: ------------------------------------------------------------------------ [2021-04-09 14:04:38] php at yopmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80945&edit=1

« previous php.doc.bugs (#18748) next »