diff --git a/_archive/src/filesystem/composer.json b/_archive/src/filesystem/composer.json index 0f09452dd..dbd59de2c 100644 --- a/_archive/src/filesystem/composer.json +++ b/_archive/src/filesystem/composer.json @@ -34,9 +34,9 @@ "require": { "php": "^8.4", "psr/http-message": "^2.0", - "symfony/finder": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0", + "symfony/finder": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", "hypervel/collections": "^0.4", "hypervel/conditionable": "^0.4", "hypervel/container": "^0.4", @@ -58,7 +58,7 @@ "league/flysystem-google-cloud-storage": "Required to use the Flysystem Google Cloud Storage driver (^3.25.1).", "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.25.1).", "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.25.1).", - "symfony/filesystem": "Required to use relative symbolic links (^8.0)." + "symfony/filesystem": "Required to use relative symbolic links (^8.1)." }, "config": { "sort-packages": true diff --git a/_archive/src/serializer/composer.json b/_archive/src/serializer/composer.json index 67a8d73f8..9d1416a68 100644 --- a/_archive/src/serializer/composer.json +++ b/_archive/src/serializer/composer.json @@ -33,8 +33,8 @@ "php": "^8.4", "doctrine/instantiator": "^1.5|^2.0", "hypervel/contracts": "^0.4", - "symfony/property-access": "^8.0", - "symfony/serializer": "^8.0" + "symfony/property-access": "^8.1", + "symfony/serializer": "^8.1" }, "config": { "sort-packages": true diff --git a/composer.json b/composer.json index 19fb4eac6..dc295e9af 100644 --- a/composer.json +++ b/composer.json @@ -183,22 +183,22 @@ "psy/psysh": "^0.12.22", "sentry/sentry": "^4.15", "spomky-labs/otphp": "^11.0", - "symfony/console": "^8.0", - "symfony/error-handler": "^8.0", - "symfony/finder": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0.12", - "symfony/mailer": "^8.0.12", - "symfony/mime": "^8.0.12", + "symfony/console": "^8.1", + "symfony/error-handler": "^8.1", + "symfony/finder": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", + "symfony/mailer": "^8.1", + "symfony/mime": "^8.1", "symfony/polyfill-php85": "^1.33", "symfony/polyfill-php86": "^1.36", - "symfony/process": "^8.0.5", - "symfony/property-access": "^8.0", - "symfony/psr-http-message-bridge": "^8.0", - "symfony/routing": "^8.0.12", + "symfony/process": "^8.1", + "symfony/property-access": "^8.1", + "symfony/psr-http-message-bridge": "^8.1", + "symfony/routing": "^8.1", "symfony/serializer": "^8.1", - "symfony/uid": "^8.0", - "symfony/var-dumper": "^8.0", + "symfony/uid": "^8.1", + "symfony/var-dumper": "^8.1", "tijsverkoyen/css-to-inline-styles": "^2.2.5", "vlucas/phpdotenv": "^5.6.1", "voku/portable-ascii": "^2.0.2", @@ -295,11 +295,11 @@ "pusher/pusher-php-server": "^7.2", "resend/resend-php": "^1.0", "swoole/ide-helper": "^6.0.2", - "symfony/filesystem": "^8.0", - "symfony/http-client": "^8.0", - "symfony/mailgun-mailer": "^8.0", - "symfony/postmark-mailer": "^8.0", - "symfony/yaml": "^8.0.12", + "symfony/filesystem": "^8.1", + "symfony/http-client": "^8.1", + "symfony/mailgun-mailer": "^8.1", + "symfony/postmark-mailer": "^8.1", + "symfony/yaml": "^8.1", "typesense/typesense-php": "^5.2" }, "config": { diff --git a/dogfood/testbench-package/composer.json b/dogfood/testbench-package/composer.json index 5c4dfaf16..b46404fa9 100644 --- a/dogfood/testbench-package/composer.json +++ b/dogfood/testbench-package/composer.json @@ -36,7 +36,7 @@ "hypervel/testbench": "0.4.x-dev", "mockery/mockery": "1.6.x-dev", "phpunit/phpunit": "^13.0.3", - "symfony/yaml": "^8.0.12" + "symfony/yaml": "^8.1" }, "extra": { "hypervel": { diff --git a/src/console/composer.json b/src/console/composer.json index f47b54f61..46effeac2 100644 --- a/src/console/composer.json +++ b/src/console/composer.json @@ -32,7 +32,7 @@ "php": "^8.4", "dragonmantank/cron-expression": "^3.4", "guzzlehttp/guzzle": "^7.8.2", - "symfony/console": "^8.0", + "symfony/console": "^8.1", "hypervel/bus": "^0.4", "hypervel/cache": "^0.4", "hypervel/collections": "^0.4", diff --git a/src/context/composer.json b/src/context/composer.json index 0af058413..f77a5b4e3 100644 --- a/src/context/composer.json +++ b/src/context/composer.json @@ -25,7 +25,7 @@ ], "require": { "php": "^8.4", - "symfony/http-foundation": "^8.0", + "symfony/http-foundation": "^8.1", "hypervel/coroutine": "^0.4", "hypervel/engine": "^0.4", "hypervel/http": "^0.4", diff --git a/src/core/composer.json b/src/core/composer.json index a719a628e..691946387 100644 --- a/src/core/composer.json +++ b/src/core/composer.json @@ -34,7 +34,7 @@ "hypervel/coordinator": "^0.4", "hypervel/coroutine": "^0.4", "psr/log": "^3.0", - "symfony/console": "^8.0" + "symfony/console": "^8.1" }, "config": { "sort-packages": true diff --git a/src/database/composer.json b/src/database/composer.json index 70163caa1..57839af97 100644 --- a/src/database/composer.json +++ b/src/database/composer.json @@ -33,9 +33,9 @@ "php": "^8.4", "brick/math": "^0.16", "nesbot/carbon": "^3.8.4", - "symfony/console": "^8.0", + "symfony/console": "^8.1", "symfony/polyfill-php86": "^1.36", - "symfony/process": "^8.0.5", + "symfony/process": "^8.1", "hypervel/broadcasting": "^0.4", "hypervel/collections": "^0.4", "hypervel/conditionable": "^0.4", diff --git a/src/filesystem/composer.json b/src/filesystem/composer.json index 5ddaf6c1f..85f180b52 100644 --- a/src/filesystem/composer.json +++ b/src/filesystem/composer.json @@ -39,9 +39,9 @@ "league/flysystem-path-prefixing": "^3.25.1", "league/flysystem-read-only": "^3.25.1", "psr/http-message": "^2.0", - "symfony/finder": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0.12", + "symfony/finder": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", "hypervel/collections": "^0.4", "hypervel/conditionable": "^0.4", "hypervel/container": "^0.4", @@ -59,8 +59,8 @@ "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.25.1).", "league/flysystem-google-cloud-storage": "Required to use the Flysystem Google Cloud Storage driver (^3.25.1).", "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.25.1).", - "symfony/filesystem": "Required to use relative symbolic links (^8.0).", - "symfony/mime": "Required to enable support for guessing extensions (^8.0)." + "symfony/filesystem": "Required to use relative symbolic links (^8.1).", + "symfony/mime": "Required to enable support for guessing extensions (^8.1)." }, "config": { "sort-packages": true diff --git a/src/fortify/composer.json b/src/fortify/composer.json index 500436ee9..ec10b9019 100644 --- a/src/fortify/composer.json +++ b/src/fortify/composer.json @@ -36,7 +36,7 @@ "hypervel/view": "^0.4", "psr/clock": "^1.0", "spomky-labs/otphp": "^11.0", - "symfony/console": "^8.0" + "symfony/console": "^8.1" }, "autoload": { "psr-4": { diff --git a/src/foundation/composer.json b/src/foundation/composer.json index 8f56c0df7..6e2a5950b 100644 --- a/src/foundation/composer.json +++ b/src/foundation/composer.json @@ -28,12 +28,12 @@ "laravel/serializable-closure": "^2.0.10", "nesbot/carbon": "^3.8.4", "psr/clock": "^1.0", - "symfony/console": "^8.0", - "symfony/error-handler": "^8.0", - "symfony/finder": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0.12", - "symfony/var-dumper": "^8.0", + "symfony/console": "^8.1", + "symfony/error-handler": "^8.1", + "symfony/finder": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", + "symfony/var-dumper": "^8.1", "vlucas/phpdotenv": "^5.6.1", "hypervel/auth": "^0.4", "hypervel/broadcasting": "^0.4", diff --git a/src/horizon/composer.json b/src/horizon/composer.json index a4c7b2b5e..131b7d7d0 100644 --- a/src/horizon/composer.json +++ b/src/horizon/composer.json @@ -42,7 +42,7 @@ "hypervel/redis": "^0.4", "hypervel/support": "^0.4", "hypervel/watcher": "^0.4", - "symfony/process": "^8.0" + "symfony/process": "^8.1" }, "autoload": { "psr-4": { diff --git a/src/http-server/composer.json b/src/http-server/composer.json index 63daa1e4b..234f4fb28 100644 --- a/src/http-server/composer.json +++ b/src/http-server/composer.json @@ -37,7 +37,7 @@ "hypervel/engine": "^0.4", "hypervel/http": "^0.4", "hypervel/server": "^0.4", - "symfony/http-foundation": "^8.0" + "symfony/http-foundation": "^8.1" }, "config": { "sort-packages": true diff --git a/src/http/composer.json b/src/http/composer.json index abac92f98..1118d2edc 100644 --- a/src/http/composer.json +++ b/src/http/composer.json @@ -34,9 +34,9 @@ "guzzlehttp/guzzle": "^7.8.2", "guzzlehttp/uri-template": "^1.0", "nesbot/carbon": "^3.8.4", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0.12", - "symfony/mime": "^8.0.12", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", + "symfony/mime": "^8.1", "hypervel/collections": "^0.4", "hypervel/conditionable": "^0.4", "hypervel/container": "^0.4", diff --git a/src/http/src/Request.php b/src/http/src/Request.php index 5de5543f9..01ee9ff9d 100644 --- a/src/http/src/Request.php +++ b/src/http/src/Request.php @@ -773,7 +773,11 @@ public static function createFromBase(SymfonyRequest $request): static $newRequest->content = $request->content; if ($newRequest->isJson()) { - $newRequest->request = $newRequest->json(); + // Fill the request bag with the JSON payload and share the same bag + // as the JSON cache, mirroring the aliasing of a direct assignment + // without hitting Symfony 8.1's deprecated property setter. + $newRequest->request->replace($newRequest->json()->all()); + $newRequest->setJson($newRequest->request); } if ($request instanceof self) { diff --git a/src/http/src/Response.php b/src/http/src/Response.php index 6ac1aced6..d4a764fe5 100755 --- a/src/http/src/Response.php +++ b/src/http/src/Response.php @@ -15,7 +15,6 @@ use Override; use RuntimeException; use Symfony\Component\HttpFoundation\Response as SymfonyResponse; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; class Response extends SymfonyResponse { @@ -49,11 +48,11 @@ class Response extends SymfonyResponse */ public function __construct(mixed $content = '', int $status = 200, array $headers = []) { - $this->headers = new ResponseHeaderBag($headers); + // The parent constructor accepts the headers since Symfony 8.1; assigning + // the property directly would hit the deprecated property setter. + parent::__construct('', $status, $headers); $this->setContent($content); - $this->setStatusCode($status); - $this->setProtocolVersion('1.0'); } /** diff --git a/src/inertia/composer.json b/src/inertia/composer.json index f91cc7754..fbf675b12 100644 --- a/src/inertia/composer.json +++ b/src/inertia/composer.json @@ -46,8 +46,8 @@ "hypervel/support": "^0.4", "hypervel/testing": "^0.4", "hypervel/view": "^0.4", - "symfony/console": "^8.0", - "symfony/process": "^8.0" + "symfony/console": "^8.1", + "symfony/process": "^8.1" }, "config": { "sort-packages": true diff --git a/src/mail/composer.json b/src/mail/composer.json index e931f10c1..6f953c2ca 100644 --- a/src/mail/composer.json +++ b/src/mail/composer.json @@ -32,7 +32,7 @@ "php": "^8.4", "league/commonmark": "^2.7", "psr/log": "^3.0", - "symfony/mailer": "^8.0.12", + "symfony/mailer": "^8.1", "tijsverkoyen/css-to-inline-styles": "^2.2.5", "hypervel/bus": "^0.4", "hypervel/collections": "^0.4", @@ -64,9 +64,9 @@ }, "suggest": { "aws/aws-sdk-php": "Required to use the SES mail driver (^3.235.5).", - "symfony/http-client": "Required to use the Symfony API mail transports (^8.0).", - "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^8.0).", - "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^8.0).", + "symfony/http-client": "Required to use the Symfony API mail transports (^8.1).", + "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^8.1).", + "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^8.1).", "resend/resend-php": "Required to enable support for the Resend mail transport (^1.0)." } } \ No newline at end of file diff --git a/src/notifications/composer.json b/src/notifications/composer.json index 3dad83e33..cc70b57ca 100644 --- a/src/notifications/composer.json +++ b/src/notifications/composer.json @@ -32,7 +32,7 @@ "php": "^8.4", "guzzlehttp/guzzle": "^7.8.2", "psr/http-message": "^2.0", - "symfony/mailer": "^8.0.12", + "symfony/mailer": "^8.1", "hypervel/broadcasting": "^0.4", "hypervel/bus": "^0.4", "hypervel/collections": "^0.4", diff --git a/src/passkeys/composer.json b/src/passkeys/composer.json index 629a5288b..15c925f60 100644 --- a/src/passkeys/composer.json +++ b/src/passkeys/composer.json @@ -29,7 +29,7 @@ "hypervel/support": "^0.4", "hypervel/validation": "^0.4", "paragonie/constant_time_encoding": "^3.1", - "symfony/console": "^8.0", + "symfony/console": "^8.1", "symfony/serializer": "^8.1", "web-auth/cose-lib": "^4.5", "web-auth/webauthn-lib": "^5.3" diff --git a/src/process/composer.json b/src/process/composer.json index 69e5e3286..e805392d7 100644 --- a/src/process/composer.json +++ b/src/process/composer.json @@ -29,7 +29,7 @@ "hypervel/contracts": "^0.4", "hypervel/macroable": "^0.4", "hypervel/support": "^0.4", - "symfony/process": "^8.0.5" + "symfony/process": "^8.1" }, "autoload": { "psr-4": { diff --git a/src/prompts/composer.json b/src/prompts/composer.json index 47247b22d..1290ca991 100644 --- a/src/prompts/composer.json +++ b/src/prompts/composer.json @@ -32,8 +32,8 @@ "ext-mbstring": "*", "composer-runtime-api": "^2.2", "nunomaduro/termwind": "^2.0", - "symfony/console": "^8.0", - "symfony/process": "^8.0", + "symfony/console": "^8.1", + "symfony/process": "^8.1", "hypervel/collections": "^0.4", "hypervel/context": "^0.4", "hypervel/coroutine": "^0.4" diff --git a/src/queue/composer.json b/src/queue/composer.json index 145b6a0fc..5dd0fbdaa 100644 --- a/src/queue/composer.json +++ b/src/queue/composer.json @@ -26,8 +26,8 @@ "php": "^8.4", "laravel/serializable-closure": "^2.0.10", "nesbot/carbon": "^3.8.4", - "symfony/console": "^8.0", - "symfony/process": "^8.0.5", + "symfony/console": "^8.1", + "symfony/process": "^8.1", "hypervel/bus": "^0.4", "hypervel/cache": "^0.4", "hypervel/collections": "^0.4", diff --git a/src/routing/composer.json b/src/routing/composer.json index a7b8bab33..bcf2ee990 100644 --- a/src/routing/composer.json +++ b/src/routing/composer.json @@ -46,11 +46,11 @@ "hypervel/session": "^0.4", "hypervel/support": "^0.4", "hypervel/view": "^0.4", - "symfony/console": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/http-kernel": "^8.0.12", - "symfony/psr-http-message-bridge": "^8.0", - "symfony/routing": "^8.0.12" + "symfony/console": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/http-kernel": "^8.1", + "symfony/psr-http-message-bridge": "^8.1", + "symfony/routing": "^8.1" }, "config": { "sort-packages": true diff --git a/src/scout/composer.json b/src/scout/composer.json index ba4624e53..4a1cbc03d 100644 --- a/src/scout/composer.json +++ b/src/scout/composer.json @@ -49,7 +49,7 @@ "hypervel/pagination": "^0.4", "hypervel/queue": "^0.4", "hypervel/support": "^0.4", - "symfony/console": "^8.0" + "symfony/console": "^8.1" }, "suggest": { "algolia/algoliasearch-client-php": "Required for Algolia driver (^4.0)", diff --git a/src/server/composer.json b/src/server/composer.json index 6791082c1..ff1441a59 100644 --- a/src/server/composer.json +++ b/src/server/composer.json @@ -31,7 +31,7 @@ "require": { "php": "^8.4", "psr/log": "^3.0", - "symfony/console": "^8.0", + "symfony/console": "^8.1", "hypervel/contracts": "^0.4", "hypervel/engine": "^0.4", "hypervel/events": "^0.4", diff --git a/src/support/composer.json b/src/support/composer.json index 187b3bb36..fdff28a96 100644 --- a/src/support/composer.json +++ b/src/support/composer.json @@ -29,7 +29,7 @@ "league/uri": "^7.5.1", "nesbot/carbon": "^3.8.4", "phpoption/phpoption": "^1.9", - "symfony/uid": "^8.0", + "symfony/uid": "^8.1", "vlucas/phpdotenv": "^5.6.1", "voku/portable-ascii": "^2.0.2", "hypervel/bus": "^0.4", diff --git a/src/testbench/composer.json b/src/testbench/composer.json index c584e2e45..8cb72f192 100644 --- a/src/testbench/composer.json +++ b/src/testbench/composer.json @@ -27,7 +27,7 @@ "composer-runtime-api": "^2.2", "mockery/mockery": "1.6.x-dev", "phpunit/phpunit": "^13.0.3", - "symfony/yaml": "^8.0.12", + "symfony/yaml": "^8.1", "vlucas/phpdotenv": "^5.6.1", "hypervel/collections": "^0.4", "hypervel/context": "^0.4", diff --git a/src/testing/composer.json b/src/testing/composer.json index b4c753a44..e08b59c7d 100644 --- a/src/testing/composer.json +++ b/src/testing/composer.json @@ -33,9 +33,9 @@ "ext-dom": "*", "composer-runtime-api": "^2.2", "mockery/mockery": "1.6.x-dev", - "symfony/console": "^8.0", - "symfony/http-foundation": "^8.0", - "symfony/process": "^8.0.5", + "symfony/console": "^8.1", + "symfony/http-foundation": "^8.1", + "symfony/process": "^8.1", "vlucas/phpdotenv": "^5.6.1", "hypervel/collections": "^0.4", "hypervel/conditionable": "^0.4", diff --git a/src/tinker/composer.json b/src/tinker/composer.json index ac5ce2b51..673b03337 100644 --- a/src/tinker/composer.json +++ b/src/tinker/composer.json @@ -38,7 +38,7 @@ "hypervel/foundation": "^0.4", "hypervel/support": "^0.4", "psy/psysh": "^0.12.22", - "symfony/var-dumper": "^8.0" + "symfony/var-dumper": "^8.1" }, "suggest": { "hypervel/database": "Required for Eloquent model casting in Tinker (^0.4)." diff --git a/tests/Http/HttpRequestTest.php b/tests/Http/HttpRequestTest.php index 6d4bfa17d..2d8c3bd36 100644 --- a/tests/Http/HttpRequestTest.php +++ b/tests/Http/HttpRequestTest.php @@ -8,6 +8,8 @@ use Hypervel\Routing\Route; use Hypervel\Tests\TestCase; use RuntimeException; +use Symfony\Component\HttpFoundation\InputBag; +use Symfony\Component\HttpFoundation\Request as SymfonyRequest; class HttpRequestTest extends TestCase { @@ -64,4 +66,54 @@ public function testFingerprintThrowsWhenRouteIsUnavailable(): void $request->fingerprint(); } + + public function testJsonRequestFillsRequestBodyParams(): void + { + $body = [ + 'foo' => 'bar', + 'baz' => ['qux'], + ]; + + $server = [ + 'CONTENT_TYPE' => 'application/json', + ]; + + $base = SymfonyRequest::create('/', 'GET', [], [], [], $server, json_encode($body)); + + $request = Request::createFromBase($base); + + $this->assertEquals($request->request->all(), $body); + } + + public function testGeneratingJsonRequestFromParentRequestUsesCorrectType(): void + { + $base = SymfonyRequest::create('/', 'POST', server: ['CONTENT_TYPE' => 'application/json'], content: '{"hello":"world"}'); + + $request = Request::createFromBase($base); + + $this->assertInstanceOf(InputBag::class, $request->getPayload()); + $this->assertSame('world', $request->getPayload()->get('hello')); + } + + public function testCreatingJsonRequestFromBaseDoesNotTriggerRequestPropertyDeprecation(): void + { + $request = Request::createFromBase( + SymfonyRequest::create('/', 'POST', server: ['CONTENT_TYPE' => 'application/json'], content: '{"hello":"world"}') + ); + + $this->assertTrue($request->isJson()); + $this->assertSame('world', $request->input('hello')); + } + + public function testJsonRequestsCanMergeDataIntoJsonRequest(): void + { + $base = SymfonyRequest::create('/', 'POST', server: ['CONTENT_TYPE' => 'application/json'], content: '{"first":"Taylor","last":"Otwell"}'); + $request = Request::createFromBase($base); + + $request->merge([ + 'name' => $request->get('first') . ' ' . $request->get('last'), + ]); + + $this->assertSame('Taylor Otwell', $request->get('name')); + } } diff --git a/tests/Http/HttpResponseTest.php b/tests/Http/HttpResponseTest.php new file mode 100644 index 000000000..6b96f0776 --- /dev/null +++ b/tests/Http/HttpResponseTest.php @@ -0,0 +1,22 @@ + 'Taylor'], 201, ['X-Test' => 'yes']); + + $this->assertSame(201, $response->getStatusCode()); + $this->assertSame('yes', $response->headers->get('X-Test')); + $this->assertSame('1.0', $response->getProtocolVersion()); + $this->assertSame('{"name":"Taylor"}', $response->getContent()); + $this->assertSame(['name' => 'Taylor'], $response->getOriginalContent()); + } +}