php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32621 isset() reports Fatal error on multidimensional arrays
Submitted: 2005-04-07 11:41 UTC Modified: 2005-04-07 12:17 UTC
From: ivan_milaev at mail dot ru Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.4 OS: *
Private report: No CVE-ID: None
 [2005-04-07 11:41 UTC] ivan_milaev at mail dot ru
Description:
------------
php.ini-recomended is used

isset() reports "Fatal error: Cannot use string offset as an array" when trying to check if the element of multidimensional array exists.

Reproduce code:
---------------
$arr['c1']='aaa'; 
var_dump(isset($arr['c1']['c2']['c3'])); // bool(false)
var_dump(isset($arr['c1']['c2']['c3']['c4'])); // Fatal error

Expected result:
----------------
bool(false)
bool(false)

Actual result:
--------------
bool(false)
Fatal error: Cannot use string offset as an array in ... on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-07 12:02 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://www.php.net/manual/en/migration5.incompatible.php
Read the third entry.
 [2005-04-07 12:17 UTC] ivan_milaev at mail dot ru
But "isset($arr['c1']['c2']['c3'])" causes no error... and even no notice. Is this the bug than?
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 21:03:35 2022 UTC