libvips / libvips/php-vips

`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.

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

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.

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.