Doc #81411 [NEW]: Casting object with numeric keys to array
| From: | biziclop at vipmail dot hu | Date: | Fri, 03 Sep 2021 08:57:02 +0000 |
| Subject: | Doc #81411 [NEW]: Casting object with numeric keys to array | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-19152@lists.php.net to get a copy of this message | ||
From: biziclop at vipmail dot hu
Operating system: N/A
PHP version: Irrelevant
Package: Arrays related
Bug Type: Documentation Problem
Bug description:Casting object with numeric keys to array
Description:
------------
---
From manual page:
https://www.php.net/manual/en/language.types.array.php#language.types.array.casting
---
"with a few notable exceptions: integer properties are unaccessible"
This is fortunately untrue since PHP 7.2:
https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
The reverse direction (array to object casts) are already documented:
https://www.php.net/manual/en/language.types.object.php#language.types.object.casting
"Note that in this case before PHP 7.2.0 numeric keys have been
inaccessible unless iterated."
Test script:
---------------
https://3v4l.org/cJPlX
--
Edit bug report at https://bugs.php.net/bug.php?id=81411&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81411&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81411&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81411&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81411&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81411&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81411&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81411&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81411&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81411&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81411&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81411&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81411&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81411&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81411&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81411&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81411&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81411&r=mysqlcfg