Edit report at https://bugs.php.net/bug.php?id=61138&edit=1
ID: 61138 User updated by: uginroot at gmail dot com Reported by: uginroot at gmail dot com Summary: convert object Status: Not a bug Type: Bug Package: Class/Object related Operating System: Windows 7 PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: Link is not working. Why, then var_dump foreach and return the "right" keys and valuesââ? but the values ââ in these keys are not available. СÑÑлка не ÑабоÑаÑ. ÐоÑÐµÐ¼Ñ Ñогда var_dump и foreach возвÑаÑаÑÑ "пÑавилÑнÑе" клÑÑи и знаÑениÑ? но знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾ даннÑм клÑÑам недоÑÑÑпнÑ. Previous Comments: ------------------------------------------------------------------------ [2012-02-19 06:19:39] ahar...@php.net As documented at http://au2.php.net/manual/en/language.types.array.php, integer properties in objects that are cast to an array are inaccessible. ------------------------------------------------------------------------ [2012-02-19 05:57:34] uginroot at gmail dot com Description: ------------ $product = json_decode('{"name":"Anton","1":"is not null"}'); print_r($product); var_dump($product->name); var_dump($product->{'1'}); $product = (array)$product; print_r($product); var_dump($product['name']); var_dump($product['1']); Test script: --------------- <?php $product = json_decode('{"name":"Anton","1":"is not null"}'); print_r($product); var_dump($product->name); var_dump($product->{'1'}); $product = (array)$product; print_r($product); var_dump($product['name']); var_dump($product['1']); Expected result: ---------------- stdClass Object ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Array ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Actual result: -------------- stdClass Object ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Array ( [name] => Anton [1] => is not null ) string(5) "Anton" NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61138&edit=1