Bug #75423 [NEW]: Isset not work on array with stdClasses

From: Date: Tue, 24 Oct 2017 09:05:37 +0000
Subject: Bug #75423 [NEW]: Isset not work on array with stdClasses
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212258@lists.php.net to get a copy of this message
From: rynkiewiczm at gmail dot com Operating system: PHP version: 7.1.10 Package: Arrays related Bug Type: Bug Bug description:Isset not work on array with stdClasses Description: ------------ 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!'; } -- Edit bug report at https://bugs.php.net/bug.php?id=75423&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75423&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75423&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75423&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75423&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75423&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75423&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75423&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75423&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75423&r=support Expected behavior: https://bugs.php.net/fix.php?id=75423&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75423&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75423&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75423&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75423&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75423&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75423&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75423&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75423&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75423&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75423&r=mysqlcfg

« previous php.bugs (#212258) next »