php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44431 Isset fails on using a string as a multidimensional array
Submitted: 2008-03-13 13:48 UTC Modified: 2008-03-13 14:12 UTC
From: spencer dot rinehart at dominionenterprises dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 5.2.5 OS: Fedora 8/Linux
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:
28 - 2 = ?
Subscribe to this entry?

 
 [2008-03-13 13:48 UTC] spencer dot rinehart at dominionenterprises dot com
Description:
------------
isset throws a fatal error when passing a string offset as an array of depth 3 or more when expected behavior would be it returning false.

Reproduce code:
---------------
$string='';
if(isset($string['test']['test']))
        echo "true\n";
else
        echo "false\n";

if(isset($string['test']['test']['test']))
        echo "true\n";
else
        echo "false\n";

Expected result:
----------------
false
false

Actual result:
--------------
false
PHP Fatal error:  Cannot use string offset as an array in /home/anubis/test.php on line 8

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-13 14:12 UTC] felipe@php.net
5.2.6 doesn't throws fatal error.
 [2008-03-13 14:12 UTC] felipe@php.net
5.2.6 doesn't throws fatal error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC