Feature-detect GLOB_BRACE for musl-libc PHP builds (Alpine, static FrankenPHP)#135
Open
superdav42 wants to merge 1 commit into
Open
Feature-detect GLOB_BRACE for musl-libc PHP builds (Alpine, static FrankenPHP)#135superdav42 wants to merge 1 commit into
superdav42 wants to merge 1 commit into
Conversation
GLOB_BRACE is undefined on PHP builds linked against musl libc
(Alpine, the official static FrankenPHP releases). In PHP 8,
referencing an undefined constant is a fatal Error, which crashes
findFirstAsset() every time the update API tries to resolve a plugin
banner or icon.
Switch to runtime feature detection:
- When GLOB_BRACE is defined, behaviour is identical to before.
- When it is missing, fall back to one glob() call per extension and
merge the results.
- The string-extension branch no longer passes GLOB_BRACE since it is
meaningless without braces.
Reproduce on any musl-libc PHP:
php -r 'var_dump(defined("GLOB_BRACE"));' # => bool(false)
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.
Summary
Wpup_UpdateServer::findFirstAsset()referencesGLOB_BRACEunconditionally:https://github.com/YahnisElsts/wp-update-server/blob/master/includes/Wpup/UpdateServer.php#L394
GLOB_BRACEis not defined on PHP builds linked against musl libc — for example Alpine container images and the official static FrankenPHP binary releases (see PHP manual note: "GLOB_BRACE is not available on some non-GNU systems, like Solaris or Alpine Linux").In PHP 8 referencing an undefined constant is a fatal
Error(not the PHP 7 warning), so every call tofindFirstAsset()crashes the update API response when it tries to resolve a plugin banner or icon:Change
Switch the array-of-extensions branch to runtime feature detection:
GLOB_BRACEis defined, behaviour is identical to before (singleglob()with the brace pattern).glob()call per extension and merge results.GLOB_BRACEsince it was meaningless without braces.Reproduce
Verification
php -lclean.Notes
No behavioural change on glibc systems. No new dependencies. No public API changes.
aidevops.sh v3.15.38 plugin for OpenCode v1.14.48 with gpt-5.5 spent 14h 36m and 15,815 tokens on this as a headless worker.