php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79262 Calling key() on ArrayObject returns nothing
Submitted: 2020-02-11 23:13 UTC Modified: 2020-02-11 23:21 UTC
From: alexander at sulu dot io Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 7.4.2 OS: MACOS Mojave
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:
30 + 32 = ?
Subscribe to this entry?

 
 [2020-02-11 23:13 UTC] alexander at sulu dot io
Description:
------------
I updated a library which did use \ArrayObject and access its key with the key function. I tested the script with both 7.4.0 and current 7.4.2 the result of the `key()` call on \ArrayObject does return in 7.4 always null instead on 7.3 it returns successfully the key. For me it looks like all array functions has no effect on the \ArrayObject.

Test script:
---------------
// should return `string(4) "test"` will return instead `NULL`
var_dump(
   key(
       new \ArrayObject(["test" => "123"])
   )
);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-11 23:21 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2020-02-11 23:21 UTC] requinix@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

https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.spl
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jun 01 20:01:24 2020 UTC