-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Summary
On 64-bit Linux, PIE detects the architecture as x86 instead of x86_64, causing pre-packaged-binary asset lookup to fail even when correctly named x86_64 assets exist in the release.
Root cause
In src/Platform/TargetPlatform.php lines 73-78:
if (
preg_match('/Architecture([ =>\t]*)(x[0-9]*)/', $phpinfo, $m)
&& array_key_exists(2, $m)
&& $m[2] !== ''
) {
$architecture = Architecture::parseArchitecture($m[2]);
}The regex x[0-9]* matches only digits after x. When phpinfo() reports Architecture => x86_64, the capture group $m[2] is x86 because the underscore in x86_64 is not matched by [0-9]*. This value is then passed to parseArchitecture("x86") which returns Architecture::x86 (the default case).
This overrides the correct Architecture::x86_64 that was already determined two lines above via PHP_INT_SIZE.
Reproduction
System: Amazon Linux 2023, PHP 8.5.1 NTS, uname -m reports x86_64, PHP_INT_SIZE is 8.
$ php -i | grep Architecture
Architecture => x86_64
$ pie install valkey-io/valkey-glide-php:1.1.0 -vvv
Target PHP installation: 8.5.1 nts, on Linux/OSX/etc x86 (from /usr/bin/php)
Trying to download using: pre-packaged-binary
Failed locating asset [pre-packaged-binary]: Could not find release asset for
valkey-io/valkey-glide-php:v1.1.0 named one of
"php_valkey_glide-v1.1.0_php8.5-x86-linux-glibc.zip,
php_valkey_glide-v1.1.0_php8.5-x86-linux-glibc.tgz,
php_valkey_glide-v1.1.0_php8.5-x86-linux-glibc-nts.zip,
php_valkey_glide-v1.1.0_php8.5-x86-linux-glibc-nts.tgz"
Selected download URL method: composer-default
PIE searches for x86 assets. The release contains php_valkey_glide-v1.1.0_php8.5-x86_64-linux-glibc.zip which is not matched.
Suggested fix
Add underscore to the character class:
preg_match('/Architecture([ =>\t]*)(x[0-9_]*)/', $phpinfo, $m)Impact
This affects every 64-bit Linux system. The pre-packaged-binary download method will never match x86_64 assets — it always looks for x86. Extensions that ship pre-built binaries with the PIE-documented x86_64 architecture name will fall back to source compilation on every install.
Note: ptondereau/biscuit-php also uses x86_64 in their release asset names, so this bug likely affects them too.
Version
PIE 1.4.x branch (commit from 2026-03-15). The feature is not yet in a released version.