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
 [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-2021 The PHP Group
All rights reserved.
Last updated: Sun Jul 25 23:01:24 2021 UTC