From c3fda98190d17f782096c57e0de58e608748b3e1 Mon Sep 17 00:00:00 2001 From: henderkes Date: Wed, 12 Aug 2026 10:40:14 +0200 Subject: [PATCH] PG(output_handler) returns a zend_string in php 8.6+ --- frankenphp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frankenphp.c b/frankenphp.c index a47b6d80a7..e39ed2c5a0 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -586,10 +586,18 @@ static int frankenphp_worker_request_startup() { sizeof(SAPI_PHP_VERSION_HEADER) - 1, 1); } + /* PG(output_handler) is a char* before PHP 8.6, a zend_string* since */ +#if PHP_VERSION_ID < 80600 if (PG(output_handler) && PG(output_handler)[0]) { zval oh; ZVAL_STRING(&oh, PG(output_handler)); +#else + if (PG(output_handler) && ZSTR_LEN(PG(output_handler))) { + zval oh; + + ZVAL_STR(&oh, zend_string_dup(PG(output_handler), false)); +#endif php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS); zval_ptr_dtor(&oh); } else if (PG(output_buffering)) {