php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73998 array_key_exists fails on arrays created by get_object_vars
Submitted: 2017-01-25 19:05 UTC Modified: 2017-03-17 16:52 UTC
From: Hauke dot Jensen at volz-software dot de Assigned: nikic (profile)
Status: Closed Package: Arrays related
PHP Version: 7.0.0 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Hauke dot Jensen at volz-software dot de
New email:
PHP Version: OS:

 

 [2017-01-25 19:05 UTC] Hauke dot Jensen at volz-software dot de
Description:
------------
array_key_exists fails on arrays created by get_object_vars on Objects with numeric Propertie Names.
It works fine in the old PHP 5.3 enviroment.

Test script:
---------------
$json = '{"100308":1}';
$temp = json_decode($json);
$sub = get_object_vars($temp); // Error Array
var_dump($sub, array_key_exists('100308', $sub));

Expected result:
----------------
array(1) {
  [100308]=>
  int(1)
}
bool(true)

Actual result:
--------------
array(1) {
  ["100308"]=>
  int(1)
}
bool(false)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-27 18:48 UTC] cmb@php.net
-Status: Open +Status: Verified -PHP Version: 7.1.1 +PHP Version: 7.0.0
 [2017-01-27 18:48 UTC] cmb@php.net
Confirmed: <https://3v4l.org/vZbPc>.
 [2017-02-02 17:43 UTC] nikic@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nikic
 [2017-03-17 16:35 UTC] ajf@php.net
Uhm: https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts

Did we just backport an RFC-agreed change from 7.2 to a 7.1 patch release?
 [2017-03-17 16:52 UTC] nikic@php.net
No, we fixed a PHP 7 regression.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC