[php-src] PHP-8.6: Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
| From: | ndossche | Date: | Mon, 26 Oct 2026 18:24:28 +0000 |
| Subject: | [php-src] PHP-8.6: Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142754@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-10-26T19:23:38+01:00
Commit: https://github.com/php/php-src/commit/470af312dd196fbc7838a5b75560396d4503991f
Raw diff: https://github.com/php/php-src/commit/470af312dd196fbc7838a5b75560396d4503991f.diff
Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
The default is non-strict, we need to keep the default for BC reasons.
We change the macro handling such that it can be enabled now, previously
it couldn't be enabled.
Closes GH-24704.
Co-authored-by: David Carlier <devnexen@gmail.com>
Changed paths:
M NEWS
M sapi/cli/php_http_parser.c
M sapi/cli/php_http_parser.h
Diff:
diff --git a/NEWS b/NEWS
index 0ee1428ba23a..91b1663e4579 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,10 @@ PHP NEWS
zend_fiber_execute()). (David Carlier)
. Fixed unmapping of an unrelated range when the aligned chunk mmap fails
(Marti2203).
+
+- CLI:
+ . Fixed bug GH-24697 (PHP_HTTP_PARSER_STRICT build option doesn't work).
+ (ndossche, devnexen)
- Date:
. Fixed bug GH-20503 (Assertion failure with ext/date DateInterval property
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index c7c2ad0caaea..252c5fcf7598 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -244,7 +244,7 @@ enum flags
#define start_state (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
-#ifdef HTTP_PARSER_STRICT
+#if HTTP_PARSER_STRICT
# define STRICT_CHECK(cond) if (cond) goto error
# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
#else
diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h
index 345ca405edd0..624474eabe3d 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -36,12 +36,10 @@ extern "C" {
#include <stdint.h>
-/* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run
- * faster
+/* Compile with -DPHP_HTTP_PARSER_STRICT=1 to enable more checks, but run
+ * slower
*/
#ifndef PHP_HTTP_PARSER_STRICT
-# define PHP_HTTP_PARSER_STRICT 1
-#else
# define PHP_HTTP_PARSER_STRICT 0
#endif