Skip to content

Commit 2af22ab

Browse files
committed
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
2 parents 30acbba + b175ea4 commit 2af22ab

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

Zend/tests/gh12826.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
GH-12826 (Weird pointers issue in nested loops)
3+
--FILE--
4+
<?php
5+
$test = array(
6+
'a' => 1,
7+
'b' => 2,
8+
'c' => 3,
9+
'd' => 4,
10+
);
11+
12+
unset($test['a']);
13+
unset($test['b']);
14+
15+
foreach($test as $k => &$v) { // Mind the reference!
16+
echo "Pass $k : ";
17+
18+
foreach($test as $kk => $vv) {
19+
echo $test[$kk];
20+
if ($kk == $k) $test[$kk] = 0;
21+
}
22+
23+
echo "\n";
24+
}
25+
26+
unset($v);
27+
?>
28+
--EXPECT--
29+
Pass c : 34
30+
Pass d : 04

Zend/zend_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
24072407
idx++; p++;
24082408
}
24092409
} else {
2410-
target->nNumUsed = source->nNumOfElements;
2410+
target->nNumUsed = source->nNumUsed;
24112411
uint32_t iter_pos = zend_hash_iterators_lower_pos(target, idx);
24122412

24132413
while (p != end) {

ext/soap/php_sdl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2393,7 +2393,9 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
23932393
/* Make sure that incomplete files (e.g. due to disk space issues, see bug #66150) are not utilised. */
23942394
if (valid_file) {
23952395
/* This is allowed to fail, this means that another process was raced to create the file. */
2396-
(void) VCWD_RENAME(ZSTR_VAL(temp_file_path), fn);
2396+
if (VCWD_RENAME(ZSTR_VAL(temp_file_path), fn) < 0) {
2397+
VCWD_UNLINK(ZSTR_VAL(temp_file_path));
2398+
}
23972399
}
23982400

23992401
smart_str_free(&buf);

0 commit comments

Comments
 (0)