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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: spencer dot rinehart at dominionenterprises dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 12:01:28 2025 UTC