Doc #80482 [NEW]: Undocumented behavior of array_walk with objects
| From: | php4fan at gmail dot com | Date: | Thu, 03 Dec 2020 17:45:11 +0000 |
| Subject: | Doc #80482 [NEW]: Undocumented behavior of array_walk with objects | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-18192@lists.php.net to get a copy of this message | ||
From: php4fan at gmail dot com
Operating system: all
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Undocumented behavior of array_walk with objects
Description:
------------
---
From manual page: https://php.net/function.array-walk
---
The documentation says that the first parameter of array_walk must be an
array, but in reality it also works when passed an object, and it
iterates over the properties.
Also, when used on ArrayObject (which, again, is undocumented in
itself), this function is affected by a dramatic bc-breaking change in
7.4 that is described in the migration guide:
https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.spl
(there's no specific mention of array_walk but I guess it falls under
"etc." and "potentially others")
Namely, when calling array_walk() on an array object, prior to 7.4 it
would iterate over the wrapped array/object, while starting from 7.4 it
iterates over the properties of the ArrayObject itself.
This should be documented in From manual page:
https://php.net/function.array-walk
Test script:
---------------
.
Expected result:
----------------
.
Actual result:
--------------
.
--
Edit bug report at https://bugs.php.net/bug.php?id=80482&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80482&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80482&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80482&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80482&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80482&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80482&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80482&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80482&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80482&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80482&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80482&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80482&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80482&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80482&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80482&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80482&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80482&r=mysqlcfg