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
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:
40 - 39 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 14:05:54 2022 UTC