Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Use __DIR__-relative path in tests
  Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
  • Loading branch information
nielsdos committed Nov 15, 2023
2 parents 16f39ec + c83632a commit d882c5d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/exif/tests/bug78793.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bug #78793: Use-after-free in exif parsing under memory sanitizer
exif
--FILE--
<?php
$f = "ext/exif/tests/bug77950.tiff";
$f = __DIR__ . "/bug77950.tiff";
for ($i = 0; $i < 10; $i++) {
@exif_read_data($f);
}
Expand Down
4 changes: 2 additions & 2 deletions ext/soap/tests/bug75306.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ soap
$options = array("cache_wsdl" => WSDL_CACHE_NONE);
// Need a warm-up for globals
for ($i = 0; $i < 10; $i++) {
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
$client = new SoapClient(__DIR__ . "/test.wsdl", $options);
}
$usage = memory_get_usage();
for ($i = 0; $i < 10; $i++) {
$client = new SoapClient("ext/soap/tests/test.wsdl", $options);
$client = new SoapClient(__DIR__ . "/test.wsdl", $options);
}
$usage_delta = memory_get_usage() - $usage;
var_dump($usage_delta);
Expand Down
2 changes: 2 additions & 0 deletions sapi/phpdbg/phpdbg_prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ PHPDBG_COMMAND(exec) /* {{{ */
if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) {
if (PHPDBG_G(in_execution)) {
if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?") == FAILURE) {
free(res);
return FAILURE;
}
}
Expand Down Expand Up @@ -440,6 +441,7 @@ PHPDBG_COMMAND(exec) /* {{{ */

phpdbg_compile();
} else {
free(res);
phpdbg_notice("Execution context not changed");
}
} else {
Expand Down
32 changes: 32 additions & 0 deletions sapi/phpdbg/tests/gh12675.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
GH-12675 (MEMORY_LEAK in phpdbg_prompt.c)
--INI--
opcache.enable=0
--PHPDBG--
ev file_put_contents("gh12675_1.tmp", "<?php echo 'hi';\necho 2;")
ev file_put_contents("gh12675_2.tmp", "<?php echo 'hi';")
exec nonexistent.php
exec gh12675_1.tmp
exec gh12675_1.tmp
b gh12675_1.tmp:2
r
exec gh12675_2.tmp
n
q
--EXPECTF--
prompt> 24
prompt> 16
prompt> [Cannot stat nonexistent.php, ensure the file exists]
prompt> [Set execution context: %sgh12675_1.tmp]
[Successful compilation of %sgh12675_1.tmp]
prompt> [Execution context not changed]
prompt> [Breakpoint #0 added at %sgh12675_1.tmp:2]
prompt> hi
[Breakpoint #0 at %sgh12675_1.tmp:2, hits: 1]
>00002: echo 2;
prompt> Do you really want to stop execution to set a new execution context? (type y or n): prompt>
--CLEAN--
<?php
@unlink("gh12675_1.tmp");
@unlink("gh12675_2.tmp");
?>

0 comments on commit d882c5d

Please sign in to comment.