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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
33 + 10 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 05:01:31 2024 UTC