1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix memory leak in phpdbg calling registered function
  Partially fix GH-17387
This commit is contained in:
Niels Dossche
2025-01-30 19:31:38 +01:00
4 changed files with 34 additions and 2 deletions

4
NEWS
View File

@@ -13,6 +13,10 @@ PHP NEWS
. Fixed bug GH-17609 (Typo in error message: Dom\NO_DEFAULT_NS instead of
Dom\HTML_NO_DEFAULT_NS). (nielsdos)
- PHPDBG:
. Partially fixed bug GH-17387 (Trivial crash in phpdbg lexer). (nielsdos)
. Fix memory leak in phpdbg calling registered function. (nielsdos)
30 Jan 2025, PHP 8.4.4
- Core:

View File

@@ -160,8 +160,9 @@ INPUT ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])*["]|[']("\\"[']|"\\\\"|[^\
<NORMAL>{GENERIC_ID} {
phpdbg_init_param(yylval, STR_PARAM);
yylval->str = estrndup(yytext, yyleng - unescape_string(yytext));
yylval->len = yyleng;
size_t len = yyleng - unescape_string(yytext);
yylval->str = estrndup(yytext, len);
yylval->len = len;
return T_ID;
}

View File

@@ -189,6 +189,9 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
zval_ptr_dtor_str(&fci.function_name);
efree(lc_name);
if (fci.named_params) {
zend_array_destroy(fci.named_params);
}
return SUCCESS;
}

View File

@@ -0,0 +1,24 @@
--TEST--
registering a function and calling it leaks arguments memory
--FILE--
<?php
echo "Done\n";
?>
--PHPDBG--
register var_dump
var_dump "a" "b"
register flush
flush
r
q
--EXPECTF--
[Successful compilation of %s]
prompt> [Registered var_dump]
prompt> string(1) "a"
string(1) "b"
prompt> [Registered flush]
prompt>
prompt> Done
[Script ended normally]
prompt>