1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 06:51:18 +02:00
Files
archived-php-src/ext
Niels Dossche 9f7d88802e Fix #80332: Completely broken array access functionality with DOMNamedNodeMap
The problem is the usage of zval_get_long(). In particular, if the
string is non-numeric the result of zval_get_long() will be 0 without
giving an error or warning. This is misleading for users: users get the
impression that they can use strings to access the map because it
coincidentally works for the first item (which is at index 0). Of
course, this fails with any other index which causes confusion and bugs.

This patch adds proper support for using string offsets while accessing
the map. It does so by detecting if it's a non-numeric string, and then
using the getNamedItem() method instead of item(). I had to split up the
array access implementation code for DOMNodeList and DOMNamedNodeMap
first to be able to do this.

Closes GH-11468.
2023-06-18 14:59:19 +02:00
..
2022-06-25 07:39:55 +01:00
2022-07-27 12:13:32 +02:00
2023-03-01 23:02:03 +01:00
2022-09-13 11:33:09 +01:00
2022-04-25 14:29:44 +02:00
2023-03-27 16:33:36 +02:00
2022-06-13 14:43:51 +02:00
2022-12-18 23:20:29 -07:00
2023-03-27 16:33:36 +02:00
2023-06-06 18:01:56 -04:00
2023-03-01 23:02:03 +01:00
2023-03-27 16:33:36 +02:00