mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
This commit is contained in:
commit
e3f04ddb0b
3 changed files with 38 additions and 0 deletions
2
NEWS
2
NEWS
|
@ -39,6 +39,8 @@ PHP NEWS
|
|||
. Fixed bug GH-10292 (Made the default value of the first param of srand() and
|
||||
mt_srand() unknown). (kocsismate)
|
||||
. Fix incorrect check in cs_8559_5 in map_from_unicode(). (nielsdos)
|
||||
. Fix bug GH-9697 for reset/end/next/prev() attempting to move pointer of
|
||||
properties table for certain internal classes such as FFI classes
|
||||
|
||||
02 Feb 2023, PHP 8.2.2
|
||||
|
||||
|
|
20
ext/ffi/tests/arrayPointer.phpt
Normal file
20
ext/ffi/tests/arrayPointer.phpt
Normal file
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
FFI: Test deprecated use of array helper functions on FFI classes doesn't crash
|
||||
--EXTENSIONS--
|
||||
ffi
|
||||
--INI--
|
||||
ffi.enable=1
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
$data = FFI::new('int');
|
||||
var_dump(reset($data));
|
||||
var_dump(end($data));
|
||||
var_dump(next($data));
|
||||
var_dump(prev($data));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
|
@ -1020,6 +1020,10 @@ PHP_FUNCTION(end)
|
|||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
HashTable *array = get_ht_for_iap(array_zv, /* separate */ true);
|
||||
if (zend_hash_num_elements(array) == 0) {
|
||||
/* array->nInternalPointer is already 0 if the array is empty, even after removing elements */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_internal_pointer_end(array);
|
||||
|
||||
if (USED_RET()) {
|
||||
|
@ -1047,6 +1051,10 @@ PHP_FUNCTION(prev)
|
|||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
HashTable *array = get_ht_for_iap(array_zv, /* separate */ true);
|
||||
if (zend_hash_num_elements(array) == 0) {
|
||||
/* array->nInternalPointer is already 0 if the array is empty, even after removing elements */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_backwards(array);
|
||||
|
||||
if (USED_RET()) {
|
||||
|
@ -1074,6 +1082,10 @@ PHP_FUNCTION(next)
|
|||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
HashTable *array = get_ht_for_iap(array_zv, /* separate */ true);
|
||||
if (zend_hash_num_elements(array) == 0) {
|
||||
/* array->nInternalPointer is already 0 if the array is empty, even after removing elements */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_move_forward(array);
|
||||
|
||||
if (USED_RET()) {
|
||||
|
@ -1101,6 +1113,10 @@ PHP_FUNCTION(reset)
|
|||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
HashTable *array = get_ht_for_iap(array_zv, /* separate */ true);
|
||||
if (zend_hash_num_elements(array) == 0) {
|
||||
/* array->nInternalPointer is already 0 if the array is empty, even after removing elements */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_internal_pointer_reset(array);
|
||||
|
||||
if (USED_RET()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue