[php-src] master: Merge branch 'PHP-8.5'

Ilia Alshanetsky <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Ilia Alshanetsky (iliaal)
Date: 2026-06-29T07:04:07-04:00

Commit: https://github.com/php/php-src/commit/10f1d04831ca0ba7e02281d2374f581b15a1e2cf
Raw diff: https://github.com/php/php-src/commit/10f1d04831ca0ba7e02281d2374f581b15a1e2cf.diff

Merge branch 'PHP-8.5'

* PHP-8.5:
  Fix GH-17387: crash on unterminated quote in phpdbg lexer

Changed paths:
  A  sapi/phpdbg/tests/gh17387.phpt
  M  sapi/phpdbg/phpdbg_lexer.l


Diff:

diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l
index ba1423c5a4ec..7c6315fc2a05 100644
--- a/sapi/phpdbg/phpdbg_lexer.l
+++ b/sapi/phpdbg/phpdbg_lexer.l
@@ -166,6 +166,13 @@ INPUT       ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])*["]|[']("\\"[']|"\\\\"|[^\
 	return T_ID;
 }
 
+<NORMAL>["'] {
+	phpdbg_init_param(yylval, STR_PARAM);
+	yylval->str = estrndup(yytext, yyleng);
+	yylval->len = yyleng;
+	return T_ID;
+}
+
 <RAW>{INPUT} {
 	phpdbg_init_param(yylval, STR_PARAM);
 	yylval->str = estrdup(yytext);
diff --git a/sapi/phpdbg/tests/gh17387.phpt b/sapi/phpdbg/tests/gh17387.phpt
new file mode 100644
index 000000000000..af45fd4ba91f
--- /dev/null
+++ b/sapi/phpdbg/tests/gh17387.phpt
@@ -0,0 +1,8 @@
+--TEST--
+GH-17387 (Trivial crash in phpdbg lexer)
+--PHPDBG--
+a';
+q
+--EXPECT--
+prompt> [The command "a" could not be found]
+prompt>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.