Use PiE on PHP 8.6#179
Merged
Merged
Conversation
pecl doesn't work on the PHP 8.6 alpha, which is why several PECL extensions (apcu, rdkafka, yaml, uuid, msgpack, decimal, amqp, memcached, ds) were being skipped entirely on 8.6. Install pie (https://php.github.io/pie/) as the pecl replacement for the 8.6 build and use it for those, plus swap the existing igbinary/imagick/ redis git-clone workarounds over to pie too, keeping the CFLAGS shims those two still need to build against the 8.6 C API changes. oauth, sqlsrv, and imap have no PIE-compatible package on Packagist yet, so those stay skipped on 8.6.
CI history on this branch shows the pecl-tarball/latest-release build of redis and igbinary previously failed on 8.6 with implicit declaration errors for zval_dtor and friends, because their last tagged releases predate the zval_dtor removal in 8.6 - only each project's unreleased default branch has the fix. That's why those two (plus imagick and mailparse, same pattern) were already pinned to `git clone --depth=1` of the default branch rather than a released version. `pie install vendor/pkg` with no constraint resolves to the latest *stable* release, i.e. exactly the versions already proven broken for these four. Keep pie only for the extensions that were plain "pecl is unavailable" skips (ds, apcu, rdkafka, yaml, uuid, msgpack, decimal, amqp, memcached), which never needed an unreleased-source workaround. Also fix a latent double-enable: the imagick git-clone step already writes its own conf.d ini, so the later unconditional `docker-php-ext-enable imagick` triggered an "already loaded" warning in build logs (visible in the acca04b CI run) even though it wasn't fatal - guard it the same way the igbinary/redis blocks already guard their install step.
…alls These were a defensive guess to avoid pie prompting interactively in a non-interactive docker build, but couldn't be verified in this environment. Let pie run its normal checks instead of suppressing them; the build tools and dev libraries pie would look for are already apk-installed up front, so the checks should just pass.
CI shows pie.phar's own Box requirements checker refuses to start, since its bundled requirement list is 8.1-8.5 and doesn't know about 8.6 yet - and in this build the only php available to run pie is the 8.6 alpha build in progress. PIE's docs document this exact escape hatch for running against an unlisted PHP version.
d866185 to
8b7ffbf
Compare
CI shows pie starts building fine (past the Box requirements checker) but fails on the very first extension (php-ds/ext-ds) because libtoolize/glibtoolize is missing, and pie won't auto-install build tools in non-interactive mode. libtool isn't part of $PHPIZE_DEPS, so add it explicitly for the 8.6 pie path.
The libtool fix cleared that warning, but ext-ds's make step still fails identically. pie truncates failed-command output to a temp file inside the (now-discarded) build container instead of printing it, so CI logs don't show the actual compiler error. Bump verbosity so the next failure is diagnosable instead of guessed at blind.
The -vvv output showed php-ds/ext-ds fails with the same "implicit declaration of function 'XtOffsetOf'" error already fixed for igbinary/imagick via a CFLAGS shim - PHP 8.6 dropped that macro in favor of plain offsetof. Since this is a core-wide 8.6 change, export CFLAGS once for the whole build instead of patching it into every extension block as each one fails.
-vvv output showed apcu failing to compile with "implicit declaration of function 'EMPTY_SWITCH_DEFAULT_CASE'" - another Zend compatibility macro PHP 8.6 dropped. Define it away as an empty function-like macro: the switches using it already enumerate every real case, so dropping the defensive unreachable-default is harmless. Verified the quoting survives Make's textual $(CFLAGS) substitution before the shell re-parses the recipe line.
The quoted -D'EMPTY_SWITCH_DEFAULT_CASE()=' broke autoconf's own
compiler sanity check ("C compiler cannot create executables"),
regressing ext-ds which was already building fine. Root cause: CFLAGS
gets consumed by two different mechanisms in the same build - Make
expands $(CFLAGS) textually and reparses the recipe line in a fresh
shell (quoting survives), but autoconf's AC_PROG_CC check expands
$CFLAGS as a plain shell variable inside eval (quoting does not
survive, so the literal quote characters reached cc and broke it).
Move the macro into a real header file and pull it in via -include,
which is just a plain path with no shell metacharacters, so it's
immune to this inconsistency. Verified with a standalone compile.
rdkafka fails compiling with "implicit declaration of function 'zval_dtor'" - the same removed function that already required a rename to zval_ptr_dtor_nogc for igbinary. Since it's a plain identifier substitution (no shell metacharacters, unlike EMPTY_SWITCH_DEFAULT_CASE), add it directly to the global CFLAGS alongside XtOffsetOf rather than needing the -include header trick.
ext-decimal fails compiling with "implicit declaration of function 'INI_INT'" - INI_INT is a macro, not a real function, so this means whatever header used to make it transitively visible no longer does on 8.6. Define it ourselves in the compat header using its long-stable canonical definition (a thin wrapper around zend_ini_long) rather than force-including the real php_ini.h out of order, since that header expects php.h's types to already be visible.
ext-decimal fails next with "'ZEND_PARSE_PARAMS_THROW' undeclared" (compiler suggests ZEND_PARSE_PARAMS_QUIET, which is not equivalent). Parameter parsing throws a TypeError by default since PHP 8.0 regardless of flags, so this flag became a redundant no-op and was dropped. Defining it as 0 in the compat header preserves the intended behavior either way.
php-amqp fails compiling with "implicit declaration of function 'INI_STR'" and 'INI_FLT' - the same transitively-missing-header issue already fixed for INI_INT. Add both using their long-stable canonical definitions. The various "makes pointer from integer without a cast" errors also seen in this build trace back to the same root cause (the compiler assumed implicit-int return types for the undeclared functions) and should clear once these are declared correctly. Also consolidated the growing per-fix prose into a compact per-macro list before it got harder to maintain than the shims themselves.
php-memcached fails compiling with "passing argument ... from incompatible pointer type": save_path is a zend_string* per PHP's PS_OPEN_FUNC, but the extension's session code still calls strstr()/ memcached_servers_parse() on it as if it were a char*. That's a real source-level type mismatch, not a missing macro or header - not something a CFLAGS shim can fix, and this session has no way to inspect php-memcached's actual source to patch it properly. Skip it for 8.6 the same way it's already skipped for 8.5, rather than guessing at a source-level fix blind.
These became byte-for-byte identical once mailparse and redis were reverted from pie back to the git-clone approach, but were left as separate case branches. Merge them back into 8.5*|8.6*) like the rest of the script - no behavior change, just removes leftover duplication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.