Skip to content

Commit 16d1d0c

Browse files
authored
Fix: php 8.6 compatibility (#2600)
Best done together with #1757 because that change is already in 8.6.0-beta1
1 parent e81ae63 commit 16d1d0c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

frankenphp.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,18 @@ static int frankenphp_worker_request_startup() {
592592
sizeof(SAPI_PHP_VERSION_HEADER) - 1, 1);
593593
}
594594

595+
/* PG(output_handler) is a char* before PHP 8.6, a zend_string* since */
596+
#if PHP_VERSION_ID < 80600
595597
if (PG(output_handler) && PG(output_handler)[0]) {
596598
zval oh;
597599

598600
ZVAL_STRING(&oh, PG(output_handler));
601+
#else
602+
if (PG(output_handler) && ZSTR_LEN(PG(output_handler))) {
603+
zval oh;
604+
605+
ZVAL_STR(&oh, zend_string_dup(PG(output_handler), false));
606+
#endif
599607
php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
600608
zval_ptr_dtor(&oh);
601609
} else if (PG(output_buffering)) {

0 commit comments

Comments
 (0)