Commit befb835
authored
Typically, PHP_VERSION and PHP_VERSION_ID are only defined when building the extension statically with PHP, since those variables are defined in php-src's own configure.ac. The variables are not defined when using phpize for a shared build.
The PHP Docker images for Alpine happen to define PHP_VERSION in their shell, but not PHP_VERSION_ID, which resulted in an "sh: out of range" error attempting to check the version. The shell-defined PHP_VERSION is also not necessarily the value we'd get from php-config (edge case where someone installs a different PHP version on top of an existing image).
This changes the logic to always rely on php-config to derive these values, as is done in various other extensions (e.g. xdebug, parallel). The awk one-liner that calculates PHP_VERSION_ID is also replaced with a direct call to `php-config --vernum`, which has been available since PHP 5.4 (php/php-src@f0fe4e0).
1 parent 4177e66 commit befb835
1 file changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 19 | + | |
| 20 | + | |
28 | 21 | | |
29 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
30 | 26 | | |
| 27 | + | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
| |||
0 commit comments