Skip to content

Commit 5287940

Browse files
authored
Fixes init validation for Termux
Termux does not store versioned `libvips`, so a unique Termux condition is used to specify the file to locate. The INI directive `zend.max_allowed_stack_size` also does not exist, so retrieving it returns `false`.
1 parent 256575d commit 5287940

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/FFI.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,17 @@ private static function init(): void
243243
if (!ini_get('ffi.enable')) {
244244
throw new Exception("ffi.enable not set to 'true'");
245245
}
246-
if (version_compare(PHP_VERSION, '8.3', '>=') &&
247-
ini_get('zend.max_allowed_stack_size') != '-1') {
246+
if (version_compare(PHP_VERSION, '8.3', '>=') &&
247+
ini_get('zend.max_allowed_stack_size') !== '-1' &&
248+
ini_get('zend.max_allowed_stack_size') !== false) {
248249
throw new Exception("zend.max_allowed_stack_size not set to '-1'");
249250
}
250251

251-
$vips_libname = self::libraryName("libvips", 42);
252+
// Use "libvips.so" on Termux, otherwise use the standard versioned library
253+
$vips_libname = getenv('PREFIX') === '/data/data/com.termux/files/usr'
254+
? "libvips.so"
255+
: self::libraryName("libvips", 42);
256+
252257
if (PHP_OS_FAMILY === "Windows") {
253258
$glib_libname = self::libraryName("libglib-2.0", 0);
254259
$gobject_libname = self::libraryName("libgobject-2.0", 0);

0 commit comments

Comments
 (0)