php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80053 Undefined array key "12345"...
Submitted: 2020-09-03 20:41 UTC Modified: 2020-09-03 20:43 UTC
From: cocnick2000 at gmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 8.0.0beta3 OS: Windows 10 2004 64Bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cocnick2000 at gmail dot com
New email:
PHP Version: OS:

 

 [2020-09-03 20:41 UTC] cocnick2000 at gmail dot com
Description:
------------
on php7.4.9 i can unset my session array but on php8.0beta3 i get following error message: "...undefined error key..."

Session: $_SESSION['tmp_image_access']['12345']

Test script:
---------------
if (isset($_SESSION['tmp_image_access']))
            foreach ($_SESSION['tmp_image_access'] as $row) {
                $this->db->query('UPDATE images SET username = ? WHERE token = ?', $this->data['username'], $row);
                session_unset($_SESSION['tmp_image_access'][$row]);
            }

Expected result:
----------------
The session should be deleted with the token '12345'

Actual result:
--------------
i get the following error message on the page "...Undefined array key "12345"..."

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-03 20:43 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2020-09-03 20:43 UTC] requinix@php.net
$row is not an array key. It is an array value. Your code was always broken.

You also don't seem to know what session_unset() does.
https://www.php.net/manual/en/function.session-unset.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 20:01:35 2025 UTC