Skip to content

fix(build): phpize-clean default + stale .so removal (SIGSEGV fix)#558

Merged
satwareAG-ironMike merged 1 commit into
mainfrom
fix/phpize-clean-stale-so
Jul 21, 2026
Merged

fix(build): phpize-clean default + stale .so removal (SIGSEGV fix)#558
satwareAG-ironMike merged 1 commit into
mainfrom
fix/phpize-clean-stale-so

Conversation

@satwareAG-ironMike

Copy link
Copy Markdown

Root Cause

PHP 8.5/FB3 SIGSEGV during CI was caused by a stale compiled against FB 5.0 headers being loaded with the FB 3.0 client library.

The /ext directory is a shared bind mount across all 12 Docker containers. When a FB5 container compiles firebird.so (FB_API_VER=50, which includes IResultSet::deprecatedClose() in the vtable), and a FB3 container then loads that stale .so, the IResultSet::close() call dispatches through a vtable slot that doesn't exist in FB 3.0's libfbclient → NULL function pointer → SIGSEGV during PHP shutdown.

The #if FB_API_VER >= 40 guard in closeCursor() (fb_statement.hpp:409) is correct — it uses release() on FB 3.0 and close() on FB 4.0+. The bug only manifests on header/library version mismatch.

Changes

File Change
.github/actions/build-extension/action.yml Default phpize-clean 'false''true'; add rm -f modules/firebird.so pdo_fbird/modules/pdo_fbird.so before phpize --clean
.github/workflows/ci.yml Add stale .so removal + phpize --clean to pdo_fbird standalone build step
.gitignore Add /debian/ and /dist/ build output directories

GDB Backtrace (before fix)

#0  0x0000000000000000 in ?? ()                          ← NULL function pointer call
#4  IResultSet::deprecatedClose() at IdlFbInterfaces.h:1829  ← FB 5.0 API (not in FB 3.0!)
#5  IResultSet::close() at IdlFbInterfaces.h:1849
#6  StatementWrapper::closeCursor() at fb_statement.hpp:418
#7  fbs_close_cursor() at firebird_utils.cpp:1503
#8  php_fbird_free_query_rsrc()                           ← Resource destructor during shutdown

Full 12-Container Matrix Validation

Built in FB5 container first (creates stale .so with deprecatedClose symbols), then built + tested each container (worst-case scenario).

PHP FB Tests Failed Result
8.2 3.0 408 0
8.2 4.0 408 0
8.2 5.0 408 0
8.3 3.0 408 0
8.3 4.0 408 0
8.3 5.0 408 0
8.4 3.0 408 0
8.4 4.0 408 0
8.4 5.0 408 0
8.5 3.0 408 0
8.5 4.0 408 0
8.5 5.0 408 0

12/12 PASS, 4,321 tests, 0 failures.

Code Review

Reviewed via task tool — no bugs found. Two notes addressed:

  1. pdo_fbird standalone build in ci.yml now also cleans stale .so + phpize --clean
  2. Untracked test files (test_oop_multi.php, test_sigsegv.php) cleaned up, debian/ and dist/ added to .gitignore

The /ext directory is a shared bind mount across all 12 Docker containers
(PHP 8.2-8.5 x FB 3/4/5). If a container compiled against FB 5.0 headers
(FB_API_VER=50) and a subsequent container with FB 3.0 loads the stale .so,
IResultSet::close() dispatches through a vtable slot that doesn't exist in
FB 3.0's libfbclient -> NULL function pointer -> SIGSEGV during shutdown.

Root cause: Stale .so compiled against FB 5.0 headers, loaded with FB 3.0
client. The #if FB_API_VER >= 40 guard in closeCursor() (fb_statement.hpp:409)
works correctly when the .so matches the runtime library - the bug only
manifests on header/library version mismatch.

Changes:
- build-extension action: default phpize-clean 'false' -> 'true'
- build-extension action: rm -f stale .so files before phpize --clean
- ci.yml: add stale .so removal + phpize --clean to pdo_fbird standalone build
- .gitignore: add /debian/ and /dist/ build output directories

Validated: 12/12 containers pass (4,321 tests, 0 failures) after building
in FB5 container first (worst-case stale-.so scenario).

Fixes: PHP 8.5/FB3 SIGSEGV during CI (was incorrectly attributed to PHP 8.5
compatibility - it was a stale build artifact issue)
@satwareAG-ironMike
satwareAG-ironMike merged commit 9e29239 into main Jul 21, 2026
54 of 58 checks passed
@satwareAG-ironMike
satwareAG-ironMike deleted the fix/phpize-clean-stale-so branch July 21, 2026 10:28
satwareAG-ironMike added a commit that referenced this pull request Jul 21, 2026
CI/CD pipeline fixes:
- .deb Docker image: Ubuntu base + Sury PPA (fixes jammy/noble)
- release-linux.yml: cache PHP source + Firebird SDK + retry on 504
- release-windows.yml: PHP SDK availability check + retry
- publish-release.yml: relax asset requirements for RC tags
- build-matrix.sh: is_ubuntu() helper + conditional Sury PPA setup

Version bump:
- VERSION.txt: 13.0.1 -> 13.0.1-rc.1
- stubs/*.php: @Version 13.0.1 -> 13.0.1-rc.1
- CHANGELOG.md: [13.0.1-rc.1] section with all fixes

Sigsegv fix (from PR #558, already merged to main):
- phpize-clean default: false -> true
- Stale .so removal before phpize --clean
- Root cause: FB 5.0 headers compiled .so loaded with FB 3.0 client
- Validated: 12/12 containers pass (4,321 tests, 0 failures)
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