php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55223 isset triggers fatal error when accessing object as array
Submitted: 2011-07-18 04:09 UTC Modified: 2011-07-21 20:03 UTC
From: Sjon at hortensius dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.3.6 OS: Archlinux
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: Sjon at hortensius dot net
New email:
PHP Version: OS:

 

 [2011-07-18 04:09 UTC] Sjon at hortensius dot net
Description:
------------
This worked for quite a long time, but stopped working recently, I suspect due to 
#53971 being fixed. I think isset should never trigger any error

Test script:
---------------
$x = new stdClass;
$x->a = 'b';
var_dump(isset($x['a']));

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

Actual result:
--------------
PHP Fatal error:  Cannot use object of type stdClass as array in php shell code 
on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-20 16:07 UTC] binarycleric at gmail dot com
It's not isset that's triggering this error.  The reason is that "$x['a']" is not 
valid when $x is an object.

Just for (cheap and lazy) regression purposes I tried this on PHP 5.2.17 and the 
same thing occurred so I don't think #53971 had anything to do with it.
 [2011-07-21 20:03 UTC] dsp@php.net
-Status: Open +Status: Bogus
 [2011-07-21 20:03 UTC] dsp@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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC