Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix GH-12826: Weird pointers issue in nested loops
  Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
This commit is contained in:
Niels Dossche 2023-12-01 17:12:33 +01:00
commit 2af22ab786
3 changed files with 34 additions and 2 deletions

30
Zend/tests/gh12826.phpt Normal file
View File

@ -0,0 +1,30 @@
--TEST--
GH-12826 (Weird pointers issue in nested loops)
--FILE--
<?php
$test = array(
'a' => 1,
'b' => 2,
'c' => 3,
'd' => 4,
);
unset($test['a']);
unset($test['b']);
foreach($test as $k => &$v) { // Mind the reference!
echo "Pass $k : ";
foreach($test as $kk => $vv) {
echo $test[$kk];
if ($kk == $k) $test[$kk] = 0;
}
echo "\n";
}
unset($v);
?>
--EXPECT--
Pass c : 34
Pass d : 04

View File

@ -2407,7 +2407,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
idx++; p++;
}
} else {
target->nNumUsed = source->nNumOfElements;
target->nNumUsed = source->nNumUsed;
uint32_t iter_pos = zend_hash_iterators_lower_pos(target, idx);
while (p != end) {

View File

@ -2393,7 +2393,9 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
/* Make sure that incomplete files (e.g. due to disk space issues, see bug #66150) are not utilised. */
if (valid_file) {
/* This is allowed to fail, this means that another process was raced to create the file. */
(void) VCWD_RENAME(ZSTR_VAL(temp_file_path), fn);
if (VCWD_RENAME(ZSTR_VAL(temp_file_path), fn) < 0) {
VCWD_UNLINK(ZSTR_VAL(temp_file_path));
}
}
smart_str_free(&buf);