Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Use __DIR__-relative path in tests
  Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
This commit is contained in:
Niels Dossche 2023-11-15 22:00:44 +01:00
commit c83632a503
5 changed files with 40 additions and 3 deletions

3
NEWS
View file

@ -8,6 +8,9 @@ PHP NEWS
- PCRE: - PCRE:
. Fixed bug GH-12628 (The gh11374 test fails on Alpinelinux). (nielsdos) . Fixed bug GH-12628 (The gh11374 test fails on Alpinelinux). (nielsdos)
- PHPDBG:
. Fixed bug GH-12675 (MEMORY_LEAK in phpdbg_prompt.c). (nielsdos)
- Standard: - Standard:
. Fix memory leak in syslog device handling. (danog) . Fix memory leak in syslog device handling. (danog)
. Fixed bug GH-12621 (browscap segmentation fault when configured in the . Fixed bug GH-12621 (browscap segmentation fault when configured in the

View file

@ -4,7 +4,7 @@ Bug #78793: Use-after-free in exif parsing under memory sanitizer
exif exif
--FILE-- --FILE--
<?php <?php
$f = "ext/exif/tests/bug77950.tiff"; $f = __DIR__ . "/bug77950.tiff";
for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; $i++) {
@exif_read_data($f); @exif_read_data($f);
} }

View file

@ -7,11 +7,11 @@ soap
$options = array("cache_wsdl" => WSDL_CACHE_NONE); $options = array("cache_wsdl" => WSDL_CACHE_NONE);
// Need a warm-up for globals // Need a warm-up for globals
for ($i = 0; $i < 10; $i++) { 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(); $usage = memory_get_usage();
for ($i = 0; $i < 10; $i++) { 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; $usage_delta = memory_get_usage() - $usage;
var_dump($usage_delta); var_dump($usage_delta);

View file

@ -407,6 +407,7 @@ PHPDBG_COMMAND(exec) /* {{{ */
if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) { if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) {
if (PHPDBG_G(in_execution)) { if (PHPDBG_G(in_execution)) {
if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?") == FAILURE) { if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?") == FAILURE) {
free(res);
return FAILURE; return FAILURE;
} }
} }
@ -440,6 +441,7 @@ PHPDBG_COMMAND(exec) /* {{{ */
phpdbg_compile(); phpdbg_compile();
} else { } else {
free(res);
phpdbg_notice("Execution context not changed"); phpdbg_notice("Execution context not changed");
} }
} else { } else {

View file

@ -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");
?>