Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
inputs:
coverage_report:
Expand All @@ -24,11 +29,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

name: Coding standards test
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
env:
EXTENSION_PATH: "my-code/common"

Expand Down Expand Up @@ -59,7 +63,7 @@ jobs:
ddev exec php -v

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: ${{env.EXTENSION_PATH}}

Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/keepalive.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
echo "version_number=$(echo ${{ env.TAG_NAME }} | sed 's/v//g' )" >> $GITHUB_OUTPUT

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Check version consistency in files
# Check src/Constants.php and CHANGELOG.md
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/sdk-chain-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
push:
paths-ignore:
- "**.md"
pull_request:
branches:
- main
paths-ignore:
- "**.md"

permissions:
contents: read
Expand All @@ -14,31 +19,28 @@ env:
jobs:
test-standalone-bouncer:
name: Run Standalone Bouncer tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@22b9a34f4623d3380e970b4c7569fe4d9397f1eb
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'
lapi_client_json: '["main"]'
capi_client_json: '["main"]'
remediation_engine_json: '["main"]'
bouncer_lib_json: '["main"]'

test-bouncer-lib:
name: Run Bouncer lib tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-cs-bouncer/.github/workflows/php-sdk-development-tests.yml@c15ac30dfb66f51c0794cb02f4449056116c85bf
uses: crowdsecurity/php-cs-bouncer/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'
lapi_client_json: '["main"]'
capi_client_json: '["main"]'
remediation_engine_json: '["main"]'

test-remediation-engine:
name: Run Remediation Engine tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-remediation-engine/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'
lapi_client_json: '["main"]'
capi_client_json: '["main"]'
secrets:
Expand All @@ -47,28 +49,25 @@ jobs:

test-lapi-client:
name: Run Lapi client tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-lapi-client/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'

test-capi-client:
name: Run Capi client tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-capi-client/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'
secrets:
TEST_MACHINE_ID: ${{ secrets.TEST_MACHINE_ID }}
TEST_MACHINE_PWD: ${{ secrets.TEST_MACHINE_PWD }}
ENROLLMENT_KEY: ${{ secrets.TEST_ENROLLMENT_KEY }}

test-magento-engine:
name: Run Magento 2 Engine module tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/magento-cs-extension/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["${{ github.ref_name }}"]'
php_common_json: '["${{ github.head_ref || github.ref_name }}"]'
lapi_client_json: '["main"]'
capi_client_json: '["main"]'
remediation_engine_json: '["main"]'
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:

schedule:
Expand All @@ -22,11 +27,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.2','7.3','7.4','8.0','8.1', '8.2', '8.3', '8.4']
php-version: ['7.2','7.3','7.4','8.0','8.1', '8.2', '8.3', '8.4', '8.5']

name: Unit tests
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
env:
EXTENSION_PATH: "my-code/common"

Expand Down Expand Up @@ -61,7 +65,7 @@ jobs:
ddev exec php -v

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: ${{env.EXTENSION_PATH}}

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ the `src` folder.

As far as possible, we try to adhere to [Symfony guidelines](https://symfony.com/doc/current/contributing/code/bc.html#working-on-symfony-code) when deciding whether a change is a breaking change or not.

---

## [3.0.1](https://github.com/crowdsecurity/php-common/releases/tag/v3.0.1) - 2025-??-??
[_Compare with previous release_](https://github.com/crowdsecurity/php-common/compare/v3.0.0...v3.0.1)

### Fixed

- Fix `curl_close` deprecation warning in PHP 8.5


---

## [3.0.0](https://github.com/crowdsecurity/php-common/releases/tag/v3.0.0) - 2025-01-31
Expand Down
6 changes: 3 additions & 3 deletions docs/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

There are many ways to install this library on a local PHP environment.

We are using [DDEV](https://ddev.readthedocs.io/en/stable/) because it is quite simple to use and customize.
We are using [DDEV](https://docs.ddev.com/en/stable/) because it is quite simple to use and customize.

Of course, you may use your own local stack, but we provide here some useful tools that depends on DDEV.

Expand All @@ -41,7 +41,7 @@ For a quick start, follow the below steps.

#### DDEV installation

For the DDEV installation, please follow the [official instructions](https://ddev.readthedocs.io/en/stable/users/install/ddev-installation/).
For the DDEV installation, please follow the [official instructions](https://docs.ddev.com/en/stable/users/install/ddev-installation/).


#### Prepare DDEV PHP environment
Expand Down Expand Up @@ -80,7 +80,7 @@ ddev config --project-type=php --php-version=8.2 --project-name=crowdsec-php-com
- Add some DDEV add-ons:

```bash
ddev get julienloizelet/ddev-tools
ddev add-on get julienloizelet/ddev-tools
```

- Clone this repo sources in a `my-code/common` folder:
Expand Down
4 changes: 3 additions & 1 deletion src/Client/RequestHandler/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function handle(Request $request): Response
throw new ClientException('Unexpected empty response http code');
}

curl_close($handle);
if (PHP_VERSION_ID < 80000) {
curl_close($handle);
}

return new Response((string) $response, $statusCode);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Constants
/**
* @var string The current version of this library
*/
public const VERSION = 'v3.0.0';
public const VERSION = 'v3.0.1';
/**
* @var string The version regex
*/
Expand Down
8 changes: 6 additions & 2 deletions tests/PHPUnitUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public static function callMethod($obj, $name, array $args)
{
$class = new \ReflectionClass($obj);
$method = $class->getMethod($name);
$method->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}

return $method->invokeArgs($obj, $args);
}
Expand All @@ -56,7 +58,9 @@ public static function setProtectedProperty($object, $property, $value)
{
$reflection = new \ReflectionClass($object);
$reflection_property = $reflection->getProperty($property);
$reflection_property->setAccessible(true);
if (PHP_VERSION_ID < 80100) {
$reflection_property->setAccessible(true);
}
$reflection_property->setValue($object, $value);
}
}
2 changes: 1 addition & 1 deletion tools/coding-standards/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"friendsofphp/php-cs-fixer": "^v3.8.0",
"phpstan/phpstan": "^1.8.0",
"phpmd/phpmd": "^2.12.0",
"squizlabs/php_codesniffer": "3.7.1",
"squizlabs/php_codesniffer": "3.7.1 || ^4.0.1",
"vimeo/psalm": "^4.24.0 || ^5.26",
"phpunit/phpunit": "^9.3",
"phpunit/php-code-coverage": "^9.2.15",
Expand Down
Loading