diff --git a/README.md b/README.md index d6b4bad..716fe50 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,18 @@ server can use it to call any native library they have access to. Of course if attackers are running their own PHP code on your webserver you are probably already toast, unfortunately. +Finally, on php 8.3 and later you need to disable stack overflow +tests. php-vips executes FFI callbacks off the main thread and this confuses +those checks, at least in php 8.3.0. + +Add: + +``` +zend.max_allowed_stack_size=-1 +``` + +To your `php.ini`. + ### Example ```php diff --git a/src/FFI.php b/src/FFI.php index 3fc8a97..56a30ae 100644 --- a/src/FFI.php +++ b/src/FFI.php @@ -236,13 +236,17 @@ private static function init(): void return; } - // the two usual installation problems + // detect the most common installation problems if (!extension_loaded('ffi')) { throw new Exception('FFI extension not loaded'); } if (!ini_get('ffi.enable')) { throw new Exception("ffi.enable not set to 'true'"); } + if (version_compare(PHP_VERSION, '8.3') && + ini_get('zend.max_allowed_stack_size') != '-1') { + throw new Exception("zend.max_allowed_stack_size not set to '-1'"); + } $vips_libname = self::libraryName("libvips", 42); if (PHP_OS_FAMILY === "Windows") {