[php-src] PR #16309: Fix out of bound writes to SafeArray data

From: Date: Tue, 08 Oct 2024 22:04:04 +0000
Subject: [php-src] PR #16309: Fix out of bound writes to SafeArray data
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-29105@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/16309 Author: cmb69 Converting PHP arrays to Variants originally supported almost arbitrary numeric arrays, possibly filling gaps with NULL values. This is broken as of PHP 7.0.0[1] so that the SafeArray only has as many elements as the PHP array. Thus, unless the array is a list, some elements may be written outside of the SafeArray data. To avoid breaking userland code after that long time, we do not restore the original behavior, but instead only suppress the erroneous writes. To avoid the need to split the regression test for 32bit and 64bit Windows, we suppress the "max number 4294967295 of elements in safe array exceeded" warning, which only occurs for 64bit versions. [1] <https://github.com/php/php-src/commit/c865472ef0c431cf3c6ec153736881d13e8a6883> --- Given the rather unintuitive behavior (see the new test case), it might be sensible to actually require a list, not an arbitrary array in PHP next. cc @nielsdos

« previous php.git-pulls (#29105) next »