Repository navigation
PDF-12283 Support PHP 8.3–8.5 and Laravel 13 apps; fix client for league/oauth2-client 2.x - #72
Merged
Merged
Conversation
…st fatal
- FillableFieldsList::offsetExists(): add `: bool` like ListObject. Without
it the class fails to load on any PHP 7+ ("must be compatible").
- ListObject / FillableFieldsList: #[\ReturnTypeWillChange] on ArrayAccess
and Iterator methods (PHP 8.1). No signature change for subclasses.
- AbstractObject: #[\AllowDynamicProperties] (PHP 8.2), DTOs store
attributes as properties.
- explicit ?Type for 6 implicitly nullable parameters (PHP 8.4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d guzzlehttp/psr7 2.x Since v3.1.0 (league/oauth2-client 1.x -> 2.x) every request failed: - getResponse() called sendRequest(), which only exists in league 1.x. Add a protected sendRequest() with the same behaviour (return 4xx/5xx responses instead of throwing, so checkResponse() handles them). - league 2.x getAccessToken() goes through getParsedResponse(), which expects getResponse() to return a ResponseInterface. Override getParsedResponse() to use our getResponse() (parse + checkResponse). - psr7 2.x removed Uri::resolve(), stream_for() and modify_request(): use UriResolver::resolve(), Utils::streamFor(), Utils::modifyRequest() (available since psr7 1.7). - http_build_query(): '' instead of null (PHP 8.1 deprecation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getAuthenticatedRequest() resolves the URL against urlApiDomain. An absolute or protocol-relative URL passed to apiCall() replaced the host, so the Bearer token was sent to that host (also on an http:// downgrade or another port). Refuse such requests with InvalidRequestException. Relative paths and absolute URLs on urlApiDomain still work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- php >=7.0 -> >=8.1 - league/oauth2-client ^2.6 -> ^2.8 (PHP 8.3/8.4 support, nullable fixes, Guzzle >= 7.4.5 for security fixes) - dev: phpunit ^10.5 || ^11.5 || ^12.5 || ^13.0; carbon ^2.31 || ^3.0 - add PHPUnit tests (Guzzle MockHandler, no network): token grants and refusals, API calls, request options, models, lists, enums, and the urlApiDomain guard; fail on warnings, notices and deprecations - README: PHP >= 8.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub-hosted runner, because the repository is public. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (18)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Jira: PDF-12283
TL;DR
Call to undefined method PDFfiller::sendRequest()), and with guzzlehttp/psr7 2.x (Uri::resolve()removed). This PR fixes it.apiCall(). Now refused.Why it was broken
v3.1.0 moved
league/oauth2-clientfrom^1.0to2.6.1without adaptingPDFfiller.php:getResponse()callssendRequest()— league 1.x only.getAccessToken()→getParsedResponse()→getResponse()expects aResponseInterface; ours returns a parsed array.Uri::resolve(),stream_for(),modify_request().The new tests run against
mastercode: 18/20 provider tests and 5/5 model tests fail (plus a fatal inFillableFieldsList, see below).Internal usage:
pdffiller/pdffillerandpdffiller/supervisorlock v3.2.0 but no code referencesPDFfiller\OAuth2\...(dead dependency). The package is public (~2.4k downloads/month on Packagist).Changes (5 commits)
1. PHP 8.1–8.5 deprecations + fatal (no public signature changes for subclasses)
DTO\FillableFieldsList::offsetExists(): add: boollike the parentListObject. Without it the class fails to load on any PHP 7+ since v3.0.0.Core\ListObject,DTO\FillableFieldsList:#[\ReturnTypeWillChange]onArrayAccess/Iteratormethods (real return types would break subclasses in consumer code).Core\AbstractObject:#[\AllowDynamicProperties](PHP 8.2) — DTOs store attributes as properties.?Type(PHP 8.4).2. HTTP layer for league 2.x / psr7 2.x (
PDFfiller.php)sendRequest()restored with the league 1.x behaviour: return 4xx/5xx responses instead of throwing, socheckResponse()handles them.getParsedResponse()overridden to use ourgetResponse()(parse +checkResponse()).UriResolver::resolve(),Utils::streamFor(),Utils::modifyRequest()(all available since psr7 1.7).http_build_query(..., '', ...)instead ofnull.3. Security: token stays on
urlApiDomaingetAuthenticatedRequest()now refuses a resolved URL whose scheme, host or port differs fromurlApiDomain(InvalidRequestException), before anything is sent.4. Dependencies, tests, README
>=7.0>=8.1^2.6^2.8(PHP 8.3/8.4 support, nullable fixes, Guzzle ≥ 7.4.5 for security fixes)^7.4^0.2.0pluralize())^10.5 || ^11.5 || ^12.5 || ^13.0^2.31^2.31 || ^3.0MockHandler(no network);phpunit.xml.distfails on warnings, notices and deprecations.5. CI:
.github/workflows/tests.yml— PHP 8.3 / 8.4 / 8.5 (highest) + 8.1 (lowest).ubuntu-latest, not the self-hosted runner, because the repo is public (fork PRs must not run on self-hosted runners).publish-on-tag.ymlunchanged.Test results (local, official
php:*-cliDocker images)src/composer requirenext tolaravel/framework13.33 on PHP 8.5: resolves; token → list → get → create → delete → error flow works against a mock, 0 PHP notices.Auth review
What the credential is and who reads it.
AccessToken(access_token,refresh_token,expires) fromurlAccessToken, created by league'sGenericProviderfrom the token response. It is only read by the PDFfiller REST API throughAuthorization: Bearer. No token format or storage change in this PR.Guard vs. our overrides.
PDFfiller::getResponse()returns an array, not aResponseInterface. In league 2.8/2.9 the only caller that expects a response object isgetParsedResponse(), now overridden;getAccessToken()andfetchResourceOwnerDetails()both go through it, socheckResponse()always runs. SwallowingBadResponseExceptionmatches league's owngetParsedResponse()and league 1.xsendRequest().Refused cases (tests): OAuth error 401 (
IdentityProviderException),errorspayload 400 (ResponseException), 500 withoutaccess_token(InvalidArgumentException), 502 HTML (UnexpectedValueException), API call without a token (not sent). After a refused token request no token is stored. Token not sent to: other host, protocol-relative host,http://downgrade, other port, host suffix (api.test.evil.test). Allowed: relative paths, absolute URLs onurlApiDomain(case-insensitive host). Model ids like//evil.test/xstay on the API host.Exposure window.
apiCall()/queryApiCall()/… would receive the Bearer token. The library itself never passes absolute URLs (all models use relative path segments), so this only matters for consumer code that passed URLs from untrusted input.Upstream notes checked: league 2.8 "send scopes with access token request" — scopes are only sent when configured; none by default here.
Not changed / follow-ups
examples/bootstrap/init.phpuses the phpdotenv v3 API (new Dotenv\Dotenv(...)) while^5.4is allowed — examples only.oodle/inflectis unmaintained; it can be replaced by a small internal pluralizer later.🤖 Generated with Claude Code
Summary by CodeRabbit