1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix Randomizer::__serialize() wrt INDIRECTs
This commit is contained in:
Niels Dossche
2025-10-08 17:39:14 +02:00
3 changed files with 22 additions and 2 deletions

3
NEWS
View File

@@ -9,6 +9,9 @@ PHP NEWS
. Fixed bug GH-20085 (Assertion failure when combining lazy object
get_properties exception with foreach loop). (nielsdos)
- Random:
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)
09 Oct 2025, PHP 8.4.14
- Core:

View File

@@ -516,8 +516,7 @@ PHP_METHOD(Random_Randomizer, __serialize)
ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
ZVAL_ARR(&t, zend_std_get_properties(&randomizer->std));
Z_TRY_ADDREF(t);
ZVAL_ARR(&t, zend_array_dup(zend_std_get_properties(&randomizer->std)));
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &t);
}
/* }}} */

View File

@@ -0,0 +1,18 @@
--TEST--
Random: Engine: __serialize() must not expose INDIRECTs
--FILE--
<?php
$randomizer = new Random\Randomizer(null);
var_dump($randomizer->__serialize());
?>
--EXPECT--
array(1) {
[0]=>
array(1) {
["engine"]=>
object(Random\Engine\Secure)#2 (0) {
}
}
}