|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-08-29 17:05 UTC] jsnell at e-normous dot com
Description: ------------ Attempting to use an array key of false on $_SESSION after a session has been started causes a notice without sufficient information to fix the problem. Also tested in latest CVS: PHP 5.2.4RC4-dev (cgi) (built: Aug 29 2007 11:53:35) Reproduce code: --------------- error_reporting(E_ALL); session_start(); $_SESSION[false] = 1; Expected result: ---------------- Notice: Unknown: Skipping numeric key 0. in test.php on line 3 Actual result: -------------- Notice: Unknown: Skipping numeric key 0. in Unknown on line 0 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 02:00:01 2025 UTC |
Replies to this continue to miss the point... The bug is not that the functionality around $SESSION is a wrong. It is that the error message is unhelpful when a person trips over this. NOTE: The issue also happens when using this: $_SESSION[] = 1; Or this: $row = <function that returns array from PDO::FETCH_BOTH or PDO::FETCH_NUMERIC>; if (!empty($row)) { foreach ($row as $key => $val) { $_SESSION[$key] = $val; } } Shouldn't the message be something like: NOTICE: Unknown: Skipping unsupported numeric key assignment in $SESSION array. And if possible (though I gather it's not), seems it should indicate the offending line of code.