|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75423 Isset not work on array with stdClasses
Submitted: 2017-10-24 09:05 UTC Modified: 2017-10-24 09:21 UTC
From: rynkiewiczm at gmail dot com Assigned:
Status: Duplicate Package: Arrays related
PHP Version: 7.1.10 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rynkiewiczm at gmail dot com
New email:
PHP Version: OS:


 [2017-10-24 09:05 UTC] rynkiewiczm at gmail dot com
When you convert array from stdClass you will get array with many stdClasses.
Isset on index of array element will not work correctly if you try it.

Test script:
$id = '11400';
$json = '{"11400":{"test":"1","test":"2","xyz":"abc"}}';
// yes, I know second parametr, but it should work too
$decodedJson = (array)json_decode($json);
if (isset($decodedJson[$id])) {
    echo 'exists!';
} else {
    echo 'not exists!';


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 09:21 UTC]
-Status: Open +Status: Duplicate
 [2017-10-24 09:21 UTC]
If I had a nickel...

This has been fixed in 7.2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 16:01:28 2024 UTC