Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: laravel/octane
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 59e1201
Choose a base ref
...
head repository: laravel/octane
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e0ab5c8
Choose a head ref
  • 3 commits
  • 6 files changed
  • 5 contributors

Commits on May 21, 2024

  1. Update CHANGELOG

    driesvints authored and github-actions[bot] committed May 21, 2024

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    e8d9d78 View commit details

Commits on May 23, 2024

  1. UrlGenerator Sandbox (#896)

    * UrlGenerator Sandbox
    
    * Fix Styl
    dbpolito authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    54a34e0 View commit details

Commits on May 24, 2024

  1. Finishes garbage collection before restarting the FrankenPHP worker p…

    …rocess (#897)
    
    * Finishes garbage collection before restarting the worker process.
    
    * Update frankenphp-worker.php
    
    ---------
    
    Co-authored-by: a.stecher <a.stecher@sportradar.com>
    Co-authored-by: Taylor Otwell <taylor@laravel.com>
    3 people authored May 24, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e0ab5c8 View commit details
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Release Notes

## [Unreleased](https://github.com/laravel/octane/compare/v2.3.10...2.x)
## [Unreleased](https://github.com/laravel/octane/compare/v2.3.11...2.x)

## [v2.3.11](https://github.com/laravel/octane/compare/v2.3.10...v2.3.11) - 2024-05-16

* Fix to stuck in "Application change detected. Restarting workers" with Octane + FrankenPHP + Sail. by [@gazzoy](https://github.com/gazzoy) in https://github.com/laravel/octane/pull/890

## [v2.3.10](https://github.com/laravel/octane/compare/v2.3.9...v2.3.10) - 2024-05-07

2 changes: 2 additions & 0 deletions bin/frankenphp-worker.php
Original file line number Diff line number Diff line change
@@ -76,4 +76,6 @@
}
} finally {
$worker?->terminate();

gc_collect_cycles();
}
1 change: 1 addition & 0 deletions src/Concerns/ProvidesDefaultConfigurationOptions.php
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ public static function prepareApplicationForNextOperation(): array
{
return [
\Laravel\Octane\Listeners\CreateConfigurationSandbox::class,
\Laravel\Octane\Listeners\CreateUrlGeneratorSandbox::class,
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToAuthorizationGate::class,
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToBroadcastManager::class,
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToDatabaseManager::class,
16 changes: 16 additions & 0 deletions src/Listeners/CreateUrlGeneratorSandbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Laravel\Octane\Listeners;

class CreateUrlGeneratorSandbox
{
/**
* Handle the event.
*
* @param mixed $event
*/
public function handle($event): void
{
$event->sandbox->instance('url', clone $event->sandbox['url']);
}
}
1 change: 1 addition & 0 deletions src/OctaneServiceProvider.php
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ protected function bindListeners()
{
$this->app->singleton(Listeners\CollectGarbage::class);
$this->app->singleton(Listeners\CreateConfigurationSandbox::class);
$this->app->singleton(Listeners\CreateUrlGeneratorSandbox::class);
$this->app->singleton(Listeners\DisconnectFromDatabases::class);
$this->app->singleton(Listeners\EnforceRequestScheme::class);
$this->app->singleton(Listeners\EnsureRequestServerPortMatchesScheme::class);
49 changes: 49 additions & 0 deletions tests/UrlGeneratorSandboxTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Laravel\Octane\Tests;

use Illuminate\Foundation\Application;
use Illuminate\Http\Request;

class UrlGeneratorSandboxTest extends TestCase
{
public function test_url_is_reset_between_requests()
{
[$app, $worker, $client] = $this->createOctaneContext([
Request::create('/first', 'GET'),
Request::create('/second', 'GET'),
]);

$app['url']->defaults(['param' => 'original']);
$app['url']->forceRootUrl('http://original');

$app['router']->get('/first', function (Application $app) {
$app['url']->defaults(['param' => 'changed']);
$app['url']->forceRootUrl('http://changed');

return [
'default' => $app['url']->getDefaultParameters(),
'url' => $app['url']->to('/'),
];
});

$app['router']->get('/second', function (Application $app) {
return [
'default' => $app['url']->getDefaultParameters(),
'url' => $app['url']->to('/'),
];
});

$worker->run();

$this->assertEquals([
'default' => ['param' => 'changed'],
'url' => 'http://changed',
], $client->responses[0]->getData(true));

$this->assertEquals([
'default' => ['param' => 'original'],
'url' => 'http://original',
], $client->responses[1]->getData(true));
}
}