Skip to content

Commit

Permalink
Drop PHP 8.0 support due to end of life and lack of security updates (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
intuibase authored Nov 25, 2024
1 parent 35a8d36 commit 0e8d560
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-php-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build PHP dependencies
run: ./tools/build/build_php_deps.sh --php_versions '80 81 82 83'
run: |
source ./tools/read_properties.sh
read_properties elastic-otel-php.properties PROJECT_PROPERTIES
PHP_VERSIONS=${PROJECT_PROPERTIES_SUPPORTED_PHP_VERSIONS//[()]/}
./tools/build/build_php_deps.sh --php_versions "${PHP_VERSIONS}"
- uses: actions/upload-artifact@v4
with:
name: php-dependencies
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-phpt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ jobs:
run: |
uname -a
echo "Arch: ${BUILD_ARCHITECTURE}"
./tools/build/test_phpt.sh --build_architecture ${BUILD_ARCHITECTURE} --results_path ${PWD}/build/test_phpt_results --php_versions '80 81 82 83'
source ./tools/read_properties.sh
read_properties elastic-otel-php.properties PROJECT_PROPERTIES
PHP_VERSIONS=${PROJECT_PROPERTIES_SUPPORTED_PHP_VERSIONS//[()]/}
./tools/build/test_phpt.sh --build_architecture ${BUILD_ARCHITECTURE} --results_path ${PWD}/build/test_phpt_results --php_versions "${PHP_VERSIONS}"
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
19 changes: 13 additions & 6 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ As a result you should see:
```bash
prod/native/_build/custom-release/loader/code/elastic_otel_php_loader.so
prod/native/_build/custom-release/extension/code/elastic_otel_php_81.so
prod/native/_build/custom-release/extension/code/elastic_otel_php_80.so
prod/native/_build/custom-release/extension/code/elastic_otel_php_82.so
prod/native/_build/custom-release/extension/code/elastic_otel_php_83.so
```
Expand All @@ -75,7 +74,7 @@ The following script will run the phpt tests for the native library, which shoul

```bash
cd elastic-otel-php
./tools/build/test_phpt.sh --build_architecture linux-x86-64 --php_versions '80 81 82 83'
./tools/build/test_phpt.sh --build_architecture linux-x86-64 --php_versions '81 82 83'
```

### Building PHP dependencies
Expand All @@ -84,7 +83,7 @@ To ensure the instrumentation is fully successful, it is required to download an

```bash
cd elastic-otel-php
./tools/build/build_php_deps.sh --php_versions '80 81 82 83'
./tools/build/build_php_deps.sh --php_versions '81 82 83'
```

### Building Packages
Expand Down Expand Up @@ -159,6 +158,16 @@ If everything works as you expected, you just need to push new image to dockerhu
docker push elasticobservability/apm-agent-php-dev:native-build-gcc-14.2.0-linux-x86-64-0.0.1
```

## Adding or removing support for PHP release

- Add the new version to the `supported_php_versions` list in the [elastic-otel.properties](elastic-otel.properties) file.
- Add or modify the supported versions array in the loader's [phpdetection.cpp](prod/native/loader/code/phpdetection.cpp) file.
- Add or remove metadata for the specified PHP version in [conandata.yml](prod/native/building/dependencies/php-headers/conandata.yml).
- Add or remove the Conan dependency for php-headers-* in [conanfile.txt](prod/native/conanfile.txt).
- Follow the steps in the ["Building the native library like on CI"](#building-the-native-library-like-on-ci) section to configure and build the agent.
- To speed up CI builds, upload Conan artifacts to Artifactory if support for the new PHP release has been added (see [Building and publishing conan artifacts](#building-and-publishing-conan-artifacts))


## Building and publishing conan artifacts

First, please remember that you need to perform all steps inside a proper docker container. This will ensure that each package receives the same unique identifier (and package will be used in CI build).
Expand Down Expand Up @@ -189,8 +198,6 @@ it should output listing similar to this:
```bash
Local Cache
...
php-headers-80
php-headers-80/2.0
php-headers-81
php-headers-81/2.0
php-headers-82
Expand All @@ -208,7 +215,7 @@ conan remote login ElasticConan [email protected]
Now you can upload package to conan artifactory.

```bash
conan upload -r=ElasticConan php-headers-80
conan upload -r=ElasticConan php-headers-81
```

Now you can check conan artifactory for new packages here:
Expand Down
2 changes: 1 addition & 1 deletion elastic-otel-php.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.2.0
supported_php_versions=(80 81 82 83)
supported_php_versions=(81 82 83)
php_headers_version=2.0
logger_features_enum_values=ALL=0,MODULE=1,REQUEST=2,TRANSPORT=3,BOOTSTRAP=4,HOOKS=5,INSTRUMENTATION=6,OTEL=7
5 changes: 0 additions & 5 deletions prod/native/building/dependencies/php-headers/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
version: 2.0
sources:
"80":
linux:
version: 8.0.30
url: "https://www.php.net/distributions/php-{}.tar.gz"
contentsRoot: "php-{}"
"81":
linux:
version: 8.1.30
Expand Down
1 change: 0 additions & 1 deletion prod/native/conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ libunwind/1.8.1
magic_enum/0.9.6
boost/1.86.0
gtest/1.15.0
php-headers-80/2.0
php-headers-81/2.0
php-headers-82/2.0
php-headers-83/2.0
Expand Down
42 changes: 22 additions & 20 deletions prod/native/loader/code/phpdetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,28 @@ bool isThreadSafe() {

std::tuple<std::string_view, int, int, bool> getZendModuleApiVersion(std::string_view zendVersion) {
using namespace std::string_view_literals;
constexpr size_t knownVersionsCount = 16;

constexpr std::array<std::tuple<std::string_view, int, int, bool>, knownVersionsCount> knownPhpVersions {{
{"4.3"sv, 83, 20230831, true}, // PHP 8.3
{"4.2"sv, 82, 20220829, true}, // PHP 8.2
{"4.1"sv, 81, 20210902, true}, // PHP 8.1
{"4.0"sv, 80, 20200930, true}, // PHP 8.0
{"3.4"sv, 74, 20190902, true}, // PHP 7.4
{"3.3"sv, 73, 20180731, false}, // PHP 7.3
{"3.2"sv, 72, 20170718, false}, // PHP 7.2
{"3.1"sv, 71, 20160303, false}, // PHP 7.1
{"3.0"sv, 70, 20151012, false}, // PHP 7.0
{"2.6"sv, 56, 20131226, false}, // PHP 5.6
{"2.5"sv, 55, 20121212, false}, // PHP 5.5
{"2.4"sv, 54, 20100525, false}, // PHP 5.4
{"2.3"sv, 53, 20090626, false}, // PHP 5.3
{"2.2"sv, 52, 20060613, false}, // PHP 5.2
{"2.1"sv, 51, 20050922, false}, // PHP 5.1
{"2.0"sv, 50, 20041030, false} // PHP 5.0
}};
constexpr size_t knownVersionsCount = 17;

// zendEngineVersion, phpVersion, zendModuleApiVersion, isVersionSupported
constexpr std::array<std::tuple<std::string_view, int, int, bool>, knownVersionsCount> knownPhpVersions{{
{"4.4"sv, 84, 20240924, false}, // PHP 8.4
{"4.3"sv, 83, 20230831, true}, // PHP 8.3
{"4.2"sv, 82, 20220829, true}, // PHP 8.2
{"4.1"sv, 81, 20210902, true}, // PHP 8.1
{"4.0"sv, 80, 20200930, false}, // PHP 8.0
{"3.4"sv, 74, 20190902, false}, // PHP 7.4
{"3.3"sv, 73, 20180731, false}, // PHP 7.3
{"3.2"sv, 72, 20170718, false}, // PHP 7.2
{"3.1"sv, 71, 20160303, false}, // PHP 7.1
{"3.0"sv, 70, 20151012, false}, // PHP 7.0
{"2.6"sv, 56, 20131226, false}, // PHP 5.6
{"2.5"sv, 55, 20121212, false}, // PHP 5.5
{"2.4"sv, 54, 20100525, false}, // PHP 5.4
{"2.3"sv, 53, 20090626, false}, // PHP 5.3
{"2.2"sv, 52, 20060613, false}, // PHP 5.2
{"2.1"sv, 51, 20050922, false}, // PHP 5.1
{"2.0"sv, 50, 20041030, false} // PHP 5.0
}};

auto foundPhpVersion = std::find_if(std::begin(knownPhpVersions), std::end(knownPhpVersions), [zendVersion](std::tuple<std::string_view, int, int, bool> const &entry) {
return std::get<0>(entry) == zendVersion;
Expand Down

0 comments on commit 0e8d560

Please sign in to comment.