`ffi.enable` check incorrect, default value passes it, even if not enabled

Open
#286 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Review src/FFI.php around line 284 and the ini_get('ffi.enable') result described in the issue. Verify the completed fix treats only an actual true value as enabled, while preload does not bypass the restriction.

Written by the indexing model from the issue text.

Description

Was trying to resolve why I kept getting this error, even though I was certain that I installed the extension properly:

Unable to open library 'libvips.42.dylib' in any of ['/opt/homebrew/lib/']. Make sure that you've installed libvips and that 'libvips.42.dylib' is on your system's library search path.

So I added a debugger and the actual error being thrown was: FFI API is restricted by "ffi.enable" configuration directive.


Since ini_get('ffi.enable') returns preload instead of false it passes the following check:
https://github.com/libvips/php-vips/blob/6dbba1bb3a4ba1e39edb71016a2aa6da5bff32ee/src/FFI.php#L284

This is incorrect and should be changed to check for an actual true.

Dominant language
PHP
Stars
721
Forks
33
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libvips/php-vips

All issues in libvips/php-vips

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.