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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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: Thu May 02 09:01:28 2024 UTC