From 5947fedbbd04761a229f94318539636b6d531436 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Mon, 28 Jul 2025 14:15:26 +0400 Subject: [PATCH] ext/standard: handle html entities empty string before processing (#19220) --- ext/standard/html.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/standard/html.c b/ext/standard/html.c index 4d1e8ab4987..af6e6ec9444 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1356,6 +1356,9 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) Z_PARAM_BOOL(double_encode); ZEND_PARSE_PARAMETERS_END(); + if (ZSTR_LEN(str) == 0) { + RETURN_EMPTY_STRING(); + } replaced = php_escape_html_entities_ex( (unsigned char*)ZSTR_VAL(str), ZSTR_LEN(str), all, (int) flags, hint_charset ? ZSTR_VAL(hint_charset) : NULL, double_encode, /* quiet */ 0);