azjezz/psl
PSL (PHP Standard Library) offers a consistent, well-typed set of safer, async-ready APIs to replace PHP primitives. Covers async, collections, networking, I/O, cryptography, terminal UI, and type-safe data validation with predictable errors.
Psl\H2\ServerConnection). For most Laravel users, this release does not impact high-level PSL APIs (e.g., HttpClient, Validation), but direct consumers of Psl\H2 must update.
content-length validation, which is non-negotiable for untrusted client traffic (e.g., public APIs, microservices). Laravel’s built-in HTTP server (e.g., php artisan serve) does not use Psl\H2 by default, but custom HTTP/2 implementations (e.g., Swoole, RoadRunner) might.String, Array, Collection), so Laravel’s integration remains unchanged.Psl\H2 for HTTP/2 handling (rare), this release requires immediate action (see Technical Risk).EventDispatcher (PSR-14) remains unaffected; Laravel’s event system integration is unchanged.Psl\H2\ServerConnection in Laravel is discouraged unless explicitly required (e.g., custom HTTP/2 servers). Prefer Laravel’s built-in HTTP clients or Guzzle for most use cases.Psl\H2 component now throws StreamException on content-length mismatches, which may break existing code relying on silent failure or partial data.HttpClient, Cache, Validation) are unaffected.Psl\H2 must now handle StreamException in tests and production. Update test cases to expect these exceptions for malformed requests.Http facade or Guzzle clients remain unchanged.| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| HTTP/2 Security Risk | Critical: Apps using Psl\H2\ServerConnection directly are vulnerable to HTTP/2 smuggling attacks. Laravel’s default stack does not use this, but custom HTTP/2 implementations (e.g., Swoole) might. |
Immediate upgrade for Psl\H2 users. Replace custom HTTP/2 logic with Laravel’s built-in HTTP clients or Guzzle if possible. |
| Exception Handling | New StreamException may crash unpatched apps if not handled. |
Update error handling to catch Psl\H2\Exception\StreamException and log/retire malformed requests. |
| Performance | HTTP/2 validation adds minimal overhead but may impact high-throughput services. | Benchmark only if using Psl\H2. For most Laravel apps, this is a non-issue. |
| Dependency Updates | PSL 6.2.1 may pull in updated dependencies (e.g., react/http). |
Run composer update php-standard-library/psl --dry-run to check for transitive dependency changes. |
| Testing Overhead | Apps using Psl\H2 must update tests to validate content-length enforcement. |
Add test cases for malformed HTTP/2 requests (e.g., mismatched content-length and DATA frames). |
Psl\H2\ServerConnection for HTTP/2 handling? If yes, this release requires urgent action.H2 component?composer require updates, or only for services using Psl\H2?H2 component?StreamException handling.Psl\H2 (now critical)?Psl\H2\ServerConnection. Laravel’s default HTTP stack (e.g., Http facade, Guzzle) is unaffected.HttpClient, Cache, Validation, or utilities. Integration remains seamless.spatie/flysystem-s3 or spatie/laravel-http-client that indirectly rely on PSL’s H2, verify their compatibility.Psl\H2 must upgrade to avoid vulnerabilities.ext-curl and ext-json are enabled for HTTP/2 support.| Phase | Action Items | Tools/Strategies |
|---|---|---|
| Assessment | Audit codebase for direct usage of Psl\H2\ServerConnection. Check for custom HTTP/2 implementations (e.g., Swoole, RoadRunner). |
grep -r "Psl\\H2\\ServerConnection" . or IDE search. Review composer.json for php-standard-library/psl usage. |
| Critical Fix | Immediate upgrade for Psl\H2 users: composer require php-standard-library/psl:^6.2.1. |
Roll out via CI/CD pipeline with security patch priority. |
| Error Handling | Update code to catch Psl\H2\Exception\StreamException and handle malformed requests gracefully. |
Add try-catch blocks around Psl\H2 usage. Log exceptions with request metadata for debugging. |
| Testing | Add tests for HTTP/2 content-length validation. Simulate malformed requests (e.g., mismatched DATA frames). |
Use tools like h2load or custom scripts to send invalid HTTP/2 requests. |
| Deprecation | If Psl\H2 is unused, consider removing it to reduce dependency bloat. |
Run composer why-not php-standard-library/psl to check for unused components. |
| Documentation | Update internal docs to warn against direct Psl\H2 usage. Recommend Laravel’s built-in HTTP clients for most use cases. |
Add a SECURITY.md section on HTTP/2 best practices. |
Http facade and Guzzle are unaffected.HttpClientInterface). The Psl\H2 fix is internal to the componentHow can I help you explore Laravel packages today?