Skip to content

fix(#165): load the platform pthread/dl libraries on macOS - #186

Merged
s2x merged 1 commit into
masterfrom
fix/issue-165-bug-nativeclient-macos-support-is-broken
Nov 6, 2026
Merged

s2x merged 1 commit into
masterfrom
fix/issue-165-bug-nativeclient-macos-support-is-broken

Conversation

@s2x

@s2x s2x commented Nov 6, 2026

Copy link
Copy Markdown
Member

What changed

NativeClient loaded libpthread.so.0 and libdl.so.2 unconditionally, so
NativeClient::getInstance() failed on macOS before the FDB library was usable.

  • src/NativeClient.php: platform-aware pthread/dl selection — libSystem.B.dylib
    on Darwin, libpthread.so.0/libdl.so.2 on Linux, a clear
    RuntimeException elsewhere — and a platform-aware default soname
    (libfdb_c.dylib on macOS).
  • tests/Unit/NativeClientPlatformLibrariesTest.php (new): Darwin/Linux
    mappings, unsupported OS rejection and default soname, without needing macOS.
  • tests/Unit/NativeClientLibraryPathTest.php: reads FDB_LIBRARY_PATH first,
    adds Homebrew//usr/local/lib//usr/lib .dylib and Linux lib64 paths,
    uses a platform-neutral skip message, and saves/restores the ambient
    FDB_LIBRARY_PATH instead of unsetting it.
  • docs/getting-started.md / README.md document the macOS library name and
    FDB_LIBRARY_PATH; CHANGELOG.md records the fix.

Refs #165 — the code is merged, but the macOS runtime load is still a manual
check (no macOS runner here), so the issue stays open until that is done.

How it was tested

  • PHP 8.2 container: Unit suite 617 tests, 1267 assertions; full suite
    926 tests, 2500 assertions, 6 skipped; Integration 309 tests, 1233 assertions, 6 skipped.
  • Unit suite with an ambient FDB_LIBRARY_PATH: the value survives the suite.
  • Linux mapping and default soname are byte-identical to before;
    resolveLibraryPath() precedence is unchanged.
  • PHPStan, PHP-CS-Fixer, Rector and git diff --check pass.
  • macOS runtime was not available; the Darwin mapping is covered by unit tests
    and inspected against libSystem/dyld semantics, but the real load remains a
    manual/macOS-CI check.

Checklist

  • Tests added or updated, and all checks pass
  • CHANGELOG.md updated under [Unreleased]
  • Documentation updated
  • Everything is written in English
  • The PR title is a Conventional Commit (fix: ...)

@s2x
s2x merged commit 22fee2e into master Nov 6, 2026
8 checks passed
@s2x
s2x deleted the fix/issue-165-bug-nativeclient-macos-support-is-broken branch November 6, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant