Repository navigation
fix: support PHP 8.4 and 8.5 without deprecation warnings - #52
Merged
Merged
Conversation
PHP 8.4 deprecates implicitly nullable parameters, so every request that loads PluginSession logged a deprecation for destroySession(). Co-authored-by: OpenCode <noreply@opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
Composer blocks phpseclib/phpseclib ^2.0 because of security advisories, so dependencies could not be installed and CI failed. The tests only used it to create key pairs, which ext-openssl can do. Co-authored-by: OpenCode <noreply@opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
PHP 8.5 deprecates null as an array key. The null key also collided with the empty string key, so the null role case was never tested on its own. Co-authored-by: OpenCode <noreply@opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
"^8.3" already allows PHP 8.4 and 8.5, so the extra "|| ^8.4" is dropped. Co-authored-by: OpenCode <noreply@opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
Co-authored-by: OpenCode <noreply@opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in these focused compatibility changes; automated tests were not run during this review.
No open issues 🎉
What changed in this PR
Updates the Staffbase PHP SDK for PHP 8.4 and 8.5 compatibility, removing deprecation warnings while preserving runtime behavior and preparing release 3.0.2.
Changes:
- Makes nullable parameters explicit in session handling, token generation, and test helpers.
- Replaces test-only phpseclib key generation with OpenSSL and removes null array keys from test data.
- Adds PHP 8.5 to CI and updates Composer metadata.
| File | Description |
|---|---|
test/SSOTokenTest.php |
Uses the shared OpenSSL key-pair helper. |
test/SSOTestData.php |
Adds RSA key-pair generation using OpenSSL. |
test/SSOData/SSODataTest.php |
Preserves null test inputs without null array keys. |
test/PluginSessionTest.php |
Uses shared key generation and explicit nullable parameters. |
src/SSOTokenGenerator.php |
Makes the optional signer explicitly nullable. |
src/SessionHandling/SessionHandlerTrait.php |
Makes the optional session ID explicitly nullable. |
composer.json |
Removes phpseclib, simplifies the PHP constraint, and sets version 3.0.2. |
.github/workflows/php.yml |
Adds PHP 8.5 to the test matrix. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal: stop the PHP 8.4+ deprecation warning and get CI green again.
What and why
On PHP 8.4+, every request that loads
PluginSessionlogs:No released version fixes this. The core change:
SSOTokenGenerator::createSignedTokenFromData()gets the same fix (?Signer $signer).CI on
mainis red: Composer blocks the test-onlyphpseclib/phpseclib ^2.0because of security advisories. The tests only used it to create RSA keys; they now use ext-openssl and the dependency is gone. Supersedes #50.Also: CI adds PHP 8.5, one test stops using
nullas an array key (deprecated in 8.5), version 3.0.2. No API or behaviour change.How to test
Runs on PHP 8.5, shows any deprecation:
Locally on PHP 8.3, 8.4 and 8.5: 26 tests pass (2 skipped, as before), no deprecations,
composer auditclean.After merge
Please tag and release 3.0.2. CC Tech's plugins need it.
Created with OpenCode; AI wrote most of this change.