Skip to content

Commit d882c5d

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Use __DIR__-relative path in tests Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
2 parents 16f39ec + c83632a commit d882c5d

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

ext/exif/tests/bug78793.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #78793: Use-after-free in exif parsing under memory sanitizer
44
exif
55
--FILE--
66
<?php
7-
$f = "ext/exif/tests/bug77950.tiff";
7+
$f = __DIR__ . "/bug77950.tiff";
88
for ($i = 0; $i < 10; $i++) {
99
@exif_read_data($f);
1010
}

ext/soap/tests/bug75306.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ soap
77
$options = array("cache_wsdl" => WSDL_CACHE_NONE);
88
// Need a warm-up for globals
99
for ($i = 0; $i < 10; $i++) {
10-
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
10+
$client = new SoapClient(__DIR__ . "/test.wsdl", $options);
1111
}
1212
$usage = memory_get_usage();
1313
for ($i = 0; $i < 10; $i++) {
14-
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
14+
$client = new SoapClient(__DIR__ . "/test.wsdl", $options);
1515
}
1616
$usage_delta = memory_get_usage() - $usage;
1717
var_dump($usage_delta);

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ PHPDBG_COMMAND(exec) /* {{{ */
407407
if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) {
408408
if (PHPDBG_G(in_execution)) {
409409
if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?") == FAILURE) {
410+
free(res);
410411
return FAILURE;
411412
}
412413
}
@@ -440,6 +441,7 @@ PHPDBG_COMMAND(exec) /* {{{ */
440441

441442
phpdbg_compile();
442443
} else {
444+
free(res);
443445
phpdbg_notice("Execution context not changed");
444446
}
445447
} else {

sapi/phpdbg/tests/gh12675.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
GH-12675 (MEMORY_LEAK in phpdbg_prompt.c)
3+
--INI--
4+
opcache.enable=0
5+
--PHPDBG--
6+
ev file_put_contents("gh12675_1.tmp", "<?php echo 'hi';\necho 2;")
7+
ev file_put_contents("gh12675_2.tmp", "<?php echo 'hi';")
8+
exec nonexistent.php
9+
exec gh12675_1.tmp
10+
exec gh12675_1.tmp
11+
b gh12675_1.tmp:2
12+
r
13+
exec gh12675_2.tmp
14+
n
15+
q
16+
--EXPECTF--
17+
prompt> 24
18+
prompt> 16
19+
prompt> [Cannot stat nonexistent.php, ensure the file exists]
20+
prompt> [Set execution context: %sgh12675_1.tmp]
21+
[Successful compilation of %sgh12675_1.tmp]
22+
prompt> [Execution context not changed]
23+
prompt> [Breakpoint #0 added at %sgh12675_1.tmp:2]
24+
prompt> hi
25+
[Breakpoint #0 at %sgh12675_1.tmp:2, hits: 1]
26+
>00002: echo 2;
27+
prompt> Do you really want to stop execution to set a new execution context? (type y or n): prompt>
28+
--CLEAN--
29+
<?php
30+
@unlink("gh12675_1.tmp");
31+
@unlink("gh12675_2.tmp");
32+
?>

0 commit comments

Comments
 (0)