Skip to content

Commit c0d4140

Browse files
committed
improve ffi startup again
thanks West14 see #183
1 parent cfe001c commit c0d4140

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to `:vips` will be documented in this file.
44

55
## master
66

7-
- fix startup on windows [West14]
7+
- improve FFI startup [West14]
88

99
## 2.1.1 - 2022-11-13
1010

examples/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"jcupitt/vips": "2.0.0"
3+
"jcupitt/vips": "2.1.1"
44
}
55
}

src/FFI.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,12 @@ private static function init(): void
201201
return;
202202
}
203203

204-
// try experimentally binding a bit of stdio ... if this fails, FFI
205-
// has probably not been installed or enabled, and php will throw a
206-
// useful error message
207-
//
208-
// this won't work on windows since there's no run time linker
209-
//
210-
// FIXME ... find a better way to test if FFI has been enabled
211-
if (PHP_OS_FAMILY !== "Windows") {
212-
$stdio = \FFI::cdef(<<<EOS
213-
int printf(const char *, ...);
214-
EOS);
204+
// the two usual install problems
205+
if (!extension_loaded('ffi')) {
206+
throw new Exception('FFI extension not loaded');
207+
}
208+
if (!ini_get('ffi.enable')) {
209+
throw new Exception("ffi.enable not set to 'true'");
215210
}
216211

217212
$vips_libname = self::libraryName("libvips", 42);

0 commit comments

Comments
 (0)