Skip to content

Commit a0b7c13

Browse files
Add GitHub Actions CI for 5.x.x and fix curl_close deprecation on PHP 8+ (#900)
This PR re-implements changes from #864, solving #863 --- 🤖 This is a minimal backport addressing PHP 8+ compatibility for the 5.x.x branch. ## Changes - **Add CI pipeline**: GitHub Actions workflow targeting PHP 7.1, 7.2, 7.3 and 7.4 - **Fix `curl_close` deprecation**: Wrap `curl_close($ch)` in a `PHP_VERSION_ID < 80000` check — `curl_close()` is a no-op and deprecated since PHP 8.0 - **`.gitattributes`**: Add `/.github export-ignore` so the workflow files are excluded from archives Fixes #863 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent feb2ca6 commit a0b7c13

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
push:
5+
branches:
6+
- 5.x.x
7+
pull_request:
8+
branches:
9+
- 5.x.x
10+
11+
jobs:
12+
tests:
13+
name: "PHP ${{ matrix.php-version }}"
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php-version: ['7.1', '7.2', '7.3', '7.4']
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v4"
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@v2"
28+
with:
29+
coverage: "none"
30+
extensions: "intl, zip"
31+
ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
32+
php-version: "${{ matrix.php-version }}"
33+
tools: composer
34+
35+
- name: "Update dependencies"
36+
run: "composer update --ansi --no-interaction --no-progress --prefer-dist"
37+
38+
- name: "Validate composer.json"
39+
run: "composer validate"
40+
41+
- name: "Run tests"
42+
run: "composer test"

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
"bin": [
6262
"bin/validate-json"
6363
],
64+
"config": {
65+
"audit": {
66+
"ignored": ["PKSA-z3gr-8qht-p93v"],
67+
"block-insecure": false
68+
}
69+
},
6470
"scripts": {
6571
"coverage": "@php phpunit --coverage-text",
6672
"style-check": "@php php-cs-fixer fix --dry-run --verbose --diff",

src/JsonSchema/Uri/Retrievers/Curl.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public function retrieve($uri)
5151
$this->fetchMessageBody($response);
5252
$this->fetchContentType($response);
5353

54-
curl_close($ch);
54+
if (PHP_VERSION_ID < 80000) {
55+
curl_close($ch);
56+
}
5557

5658
return $this->messageBody;
5759
}

0 commit comments

Comments
 (0)