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/framework
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v11.9.2
Choose a base ref
...
head repository: laravel/framework
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v11.10.0
Choose a head ref
  • 19 commits
  • 21 files changed
  • 15 contributors

Commits on May 30, 2024

  1. Update CHANGELOG

    driesvints authored and github-actions[bot] committed May 30, 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
    683e9bc View commit details
  2. Fix typo in filename (#51643)

    Henridv authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b2e9ffc View commit details
  3. [11.x] Add Vite auto refresh to error page (#51635)

    * Add Vite auto refresh to error page
    
    This adds Vite hot reloading to the error page
    
    * Update Renderer.php
    riasvdv authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8306c69 View commit details
  4. add test for join_paths (#51621)

    imanghafoori1 authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6976192 View commit details
  5. [11.x] Preload base options for missing config files (#51619)

    * Remove dead code
    
    * Preload base options for missing config files
    jasonmccreary authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    448fdb5 View commit details
  6. [11.x] Add option to disable merging of base configuration (#51579)

    * [11.x] Add option to disable merging of base configuration
    
    * fix style
    
    * fix
    
    * formatting
    
    ---------
    
    Co-authored-by: Taylor Otwell <taylor@laravel.com>
    taka-oyama and taylorotwell authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    85dbab2 View commit details
  7. Update facade docblocks

    taylorotwell authored and github-actions[bot] committed May 30, 2024
    Copy the full SHA
    f993943 View commit details
  8. [11.x] Allow callback to be passed to updateOrInsert() to pass diff…

    …erent `$values` if the record already exists (#51566)
    
    * allow a callback to be passed to `updateOrInsert()` to pass different `$values` if the record already exists
    
    * follow Laravel codestyle
    
    * update method signature to add parameter type hinting
    Markshall authored May 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    92eda54 View commit details
  9. fix join_paths issue with '0' (#51649)

    imanghafoori1 authored May 30, 2024

    Verified

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

Commits on May 31, 2024

  1. Remove extra double quote in the error page (#51670)

    nicolus authored May 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    25c363e View commit details
  2. Add tests for HtmlString (#51666)

    saMahmoudzadeh authored May 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e1c638e View commit details
  3. [11.x] Add tests to improve test coverage for Arr::whereNotNull (#5…

    …1661)
    
    * tests: add some tests for Arr::whereNotNull ( improve test coverage)
    
    * fix code style: using fn instead of function
    saMahmoudzadeh authored May 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f05f7bc View commit details
  4. Add tests for FileSystem class (#51654)

    imanghafoori1 authored May 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d33c3e5 View commit details
  5. Update OptimizeClearCommand.php (#51667)

    Added "s" for consistency with "optimize" command.
    nathanpurcell authored May 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3672fbe View commit details
  6. [11.x] Support soft deleted models when using explicit route model bi…

    …nding (#51651)
    
    * Added support for soft deleted models using explicit binding.
    
    * Fixed use statement order.
    
    * Update RouteBinding.php
    
    ---------
    
    Co-authored-by: Graham Bradley <gbradley@onlyexcel.com>
    Co-authored-by: Taylor Otwell <taylor@laravel.com>
    3 people authored May 31, 2024

    Verified

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

Commits on Jun 2, 2024

  1. [11.x] Add tests for Arr::divide (#51673)

    * Add tests for Arr::divide
    
    * fixes code style
    
    * add tests
    
    * update comments
    saMahmoudzadeh authored Jun 2, 2024

    Verified

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

Commits on Jun 3, 2024

  1. Prune should be a flag option (#51694)

    riasvdv authored Jun 3, 2024

    Verified

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

Commits on Jun 4, 2024

  1. [11.x] Avoid using Laravel new error page if app.debug changes to `…

    …true` at runtime (#51705)
    
    * [11.x] Avoid using Laravel new renderer if `app.debug` changes to `true`
    at runtime
    
    Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
    
    * wip
    
    Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
    
    ---------
    
    Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
    crynobone authored Jun 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6adf982 View commit details
  2. Update version to v11.10.0

    taylorotwell authored and github-actions[bot] committed Jun 4, 2024
    Copy the full SHA
    99b4255 View commit details
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Release Notes for 11.x

## [Unreleased](https://github.com/laravel/framework/compare/v11.9.1...11.x)
## [Unreleased](https://github.com/laravel/framework/compare/v11.9.2...11.x)

## [v11.9.2](https://github.com/laravel/framework/compare/v11.9.1...v11.9.2) - 2024-05-30

* [11.x] Fix new exception renderer compatibility with closure middleware by [@ifox](https://github.com/ifox) in https://github.com/laravel/framework/pull/51614
* [11.x] Fix double-quoted string literals on SQLite by [@hafezdivandari](https://github.com/hafezdivandari) in https://github.com/laravel/framework/pull/51615
* [11.x] Allow setting Resend api key in mailer specific config by [@riasvdv](https://github.com/riasvdv) in https://github.com/laravel/framework/pull/51618
* [11.x] Fix only number as session key will result in numbered session keys by [@Katalam](https://github.com/Katalam) in https://github.com/laravel/framework/pull/51611

## [v11.9.1](https://github.com/laravel/framework/compare/v11.9.0...v11.9.1) - 2024-05-28

12 changes: 9 additions & 3 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
@@ -3749,12 +3749,18 @@ public function updateFrom(array $values)
* Insert or update a record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
* @param array|callable $values
* @return bool
*/
public function updateOrInsert(array $attributes, array $values = [])
public function updateOrInsert(array $attributes, array|callable $values = [])
{
if (! $this->where($attributes)->exists()) {
$exists = $this->where($attributes)->exists();

if ($values instanceof Closure) {
$values = $values($exists);
}

if (! $exists) {
return $this->insert(array_merge($attributes, $values));
}

2 changes: 1 addition & 1 deletion src/Illuminate/Filesystem/functions.php
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
function join_paths($basePath, ...$paths)
{
foreach ($paths as $index => $path) {
if (empty($path)) {
if (empty($path) && $path !== '0') {
unset($paths[$index]);
} else {
$paths[$index] = DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR);
31 changes: 30 additions & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '11.9.2';
const VERSION = '11.10.0';

/**
* The base path for the Laravel installation.
@@ -194,6 +194,13 @@ class Application extends Container implements ApplicationContract, CachesConfig
*/
protected $namespace;

/**
* Indicates if the framework's base configuration should be merged.
*
* @var bool
*/
protected $mergeFrameworkConfiguration = true;

/**
* The prefixes of absolute cache paths for use during normalization.
*
@@ -1198,6 +1205,28 @@ public function handleCommand(InputInterface $input)
return $status;
}

/**
* Determine if the framework's base configuration should be merged.
*
* @return bool
*/
public function shouldMergeFrameworkConfiguration()
{
return $this->mergeFrameworkConfiguration;
}

/**
* Indicate that the framework's base configuration should not be merged.
*
* @return $this
*/
public function dontMergeFrameworkConfiguration()
{
$this->mergeFrameworkConfiguration = false;

return $this;
}

/**
* Determine if middleware has been disabled for the application.
*
15 changes: 10 additions & 5 deletions src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

namespace Illuminate\Foundation\Bootstrap;

use Exception;
use Illuminate\Config\Repository;
use Illuminate\Contracts\Config\Repository as RepositoryContract;
use Illuminate\Contracts\Foundation\Application;
@@ -62,11 +61,17 @@ protected function loadConfigurationFiles(Application $app, RepositoryContract $
{
$files = $this->getConfigurationFiles($app);

// if (! isset($files['app'])) {
// throw new Exception('Unable to load the "app" configuration file.');
// }
$shouldMerge = method_exists($app, 'shouldMergeFrameworkConfiguration')
? $app->shouldMergeFrameworkConfiguration()
: true;

$base = $this->getBaseConfiguration();
$base = $shouldMerge
? $this->getBaseConfiguration()
: [];

foreach (array_diff(array_keys($base), array_keys($files)) as $name => $config) {
$repository->set($name, $config);
}

foreach ($files as $name => $path) {
$base = $this->loadConfigurationFile($repository, $name, $path, $base);
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ class EnvironmentEncryptCommand extends Command
{--key= : The encryption key}
{--cipher= : The encryption cipher}
{--env= : The environment to be encrypted}
{--prune= : Delete the original environment file}
{--prune : Delete the original environment file}
{--force : Overwrite the existing encrypted environment file}';

/**
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/OptimizeClearCommand.php
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public function handle()
'compiled' => fn () => $this->callSilent('clear-compiled') == 0,
'config' => fn () => $this->callSilent('config:clear') == 0,
'events' => fn () => $this->callSilent('event:clear') == 0,
'route' => fn () => $this->callSilent('route:clear') == 0,
'routes' => fn () => $this->callSilent('route:clear') == 0,
'views' => fn () => $this->callSilent('view:clear') == 0,
])->each(fn ($task, $description) => $this->components->task($description, $task));

8 changes: 5 additions & 3 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -833,9 +833,11 @@ protected function renderExceptionContent(Throwable $e)
{
try {
if (config('app.debug')) {
return app()->has(ExceptionRenderer::class)
? $this->renderExceptionWithCustomRenderer($e)
: $this->container->make(Renderer::class)->render(request(), $e);
if (app()->has(ExceptionRenderer::class)) {
return $this->renderExceptionWithCustomRenderer($e);
} elseif ($this->container->bound(Renderer::class)) {
return $this->container->make(Renderer::class)->render(request(), $e);
}
}

return $this->renderExceptionWithSymfony($e, config('app.debug'));
10 changes: 9 additions & 1 deletion src/Illuminate/Foundation/Exceptions/Renderer/Renderer.php
Original file line number Diff line number Diff line change
@@ -123,8 +123,16 @@ public static function css()
*/
public static function js()
{
$viteJsAutoRefresh = '';

$vite = app(\Illuminate\Foundation\Vite::class);

if (is_file($vite->hotFile())) {
$viteJsAutoRefresh = $vite->__invoke([]);
}

return '<script type="text/javascript">'
.file_get_contents(static::DIST.'scripts.js')
.'</script>';
.'</script>'.$viteJsAutoRefresh;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section
{{ $attributes->merge(['class' => "@container flex flex-col p-6 sm:p-12 bg-white dark:bg-gray-900/80 text-gray-900 dark:text-gray-100 rounded-lg default:col-span-full default:lg:col-span-6 default:row-span-1 dark:ring-1 dark:ring-gray-800 shadow-xl"]) }}"
{{ $attributes->merge(['class' => "@container flex flex-col p-6 sm:p-12 bg-white dark:bg-gray-900/80 text-gray-900 dark:text-gray-100 rounded-lg default:col-span-full default:lg:col-span-6 default:row-span-1 dark:ring-1 dark:ring-gray-800 shadow-xl"]) }}
>
{{ $slot }}
</section>
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ class="h-6 w-6 fill-red-500 text-gray-50 dark:text-gray-950"
</div>

<div class="flex items-center gap-3 sm:gap-6">
<x-laravel-exceptions-renderer::theme-swicher />
<x-laravel-exceptions-renderer::theme-switcher />
</div>
</div>
</div>
9 changes: 7 additions & 2 deletions src/Illuminate/Routing/RouteBinding.php
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

use Closure;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;

class RouteBinding
@@ -57,7 +58,7 @@ protected static function createClassBinding($container, $binding)
*/
public static function forModel($container, $class, $callback = null)
{
return function ($value) use ($container, $class, $callback) {
return function ($value, $route) use ($container, $class, $callback) {
if (is_null($value)) {
return;
}
@@ -67,7 +68,11 @@ public static function forModel($container, $class, $callback = null)
// throw a not found exception otherwise we will return the instance.
$instance = $container->make($class);

if ($model = $instance->resolveRouteBinding($value)) {
$routeBindingMethod = $route->allowsTrashedBindings() && in_array(SoftDeletes::class, class_uses_recursive($instance))
? 'resolveSoftDeletableRouteBinding'
: 'resolveRouteBinding';

if ($model = $instance->{$routeBindingMethod}($value)) {
return $model;
}

2 changes: 2 additions & 0 deletions src/Illuminate/Support/Facades/App.php
Original file line number Diff line number Diff line change
@@ -62,6 +62,8 @@
* @method static \Symfony\Component\HttpFoundation\Response handle(\Symfony\Component\HttpFoundation\Request $request, int $type = 1, bool $catch = true)
* @method static void handleRequest(\Illuminate\Http\Request $request)
* @method static int handleCommand(\Symfony\Component\Console\Input\InputInterface $input)
* @method static bool shouldMergeFrameworkConfiguration()
* @method static \Illuminate\Foundation\Application dontMergeFrameworkConfiguration()
* @method static bool shouldSkipMiddleware()
* @method static string getCachedServicesPath()
* @method static string getCachedPackagesPath()
37 changes: 26 additions & 11 deletions tests/Filesystem/FilesystemTest.php
Original file line number Diff line number Diff line change
@@ -59,21 +59,28 @@ public function testLines()
{
$path = self::$tempDir.'/file.txt';

$contents = LazyCollection::times(3)
->map(function ($number) {
return "line-{$number}";
})
->join("\n");

$contents = ' '.PHP_EOL.' spaces around '.PHP_EOL.PHP_EOL.'Line 2'.PHP_EOL.'1 trailing empty line ->'.PHP_EOL.PHP_EOL;
file_put_contents($path, $contents);

$files = new Filesystem;
$this->assertInstanceOf(LazyCollection::class, $files->lines($path));

$this->assertSame(
['line-1', 'line-2', 'line-3'],
[' ', ' spaces around ', '', 'Line 2', '1 trailing empty line ->', '', ''],
$files->lines($path)->all()
);

// an empty file:
ftruncate(fopen($path, 'w'), 0);
$this->assertSame([''], $files->lines($path)->all());
}

public function testLinesThrowsExceptionNonexisitingFile()
{
$this->expectException(FileNotFoundException::class);
$this->expectExceptionMessage('File does not exist at path '.__DIR__.'/unknown-file.txt.');

(new Filesystem)->lines(__DIR__.'/unknown-file.txt');
}

public function testReplaceCreatesFile()
@@ -324,9 +331,9 @@ public function testMoveDirectoryReturnsFalseWhileOverwritingAndUnableToDeleteDe
public function testGetThrowsExceptionNonexisitingFile()
{
$this->expectException(FileNotFoundException::class);
$this->expectExceptionMessage('File does not exist at path '.self::$tempDir.'/unknown-file.txt.');

$files = new Filesystem;
$files->get(self::$tempDir.'/unknown-file.txt');
(new Filesystem)->get(self::$tempDir.'/unknown-file.txt');
}

public function testGetRequireReturnsProperly()
@@ -339,9 +346,9 @@ public function testGetRequireReturnsProperly()
public function testGetRequireThrowsExceptionNonExistingFile()
{
$this->expectException(FileNotFoundException::class);
$this->expectExceptionMessage('File does not exist at path '.self::$tempDir.'/unknown-file.txt.');

$files = new Filesystem;
$files->getRequire(self::$tempDir.'/file.php');
(new Filesystem)->getRequire(self::$tempDir.'/unknown-file.txt');
}

public function testJsonReturnsDecodedJsonData()
@@ -564,6 +571,14 @@ public function testRequireOnceRequiresFileProperly()
$this->assertFalse(function_exists('random_function_xyz_changed'));
}

public function testRequireOnceThrowsExceptionNonexisitingFile()
{
$this->expectException(FileNotFoundException::class);
$this->expectExceptionMessage('File does not exist at path '.__DIR__.'/unknown-file.txt.');

(new Filesystem)->requireOnce(__DIR__.'/unknown-file.txt');
}

public function testCopyCopiesFileProperly()
{
$filesystem = new Filesystem;
46 changes: 42 additions & 4 deletions tests/Filesystem/JoinPathsHelperTest.php
Original file line number Diff line number Diff line change
@@ -19,8 +19,27 @@ public function testItCanMergePathsForUnix(string $expected, string $given)

public static function unixDataProvider()
{
yield ['app/Http/Kernel.php', join_paths('app', 'Http', 'Kernel.php')];
yield ['app/Http/Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')];
yield ['very/Basic/Functionality.php', join_paths('very', 'Basic', 'Functionality.php')];
yield ['segments/get/ltrimed/by_directory/separator.php', join_paths('segments', '/get/ltrimed', '/by_directory/separator.php')];
yield ['only/\\os_separator\\/\\get_ltrimmed.php', join_paths('only', '\\os_separator\\', '\\get_ltrimmed.php')];
yield ['/base_path//does_not/get_trimmed.php', join_paths('/base_path/', '/does_not', '/get_trimmed.php')];
yield ['Empty/0/1/Segments/00/Get_removed.php', join_paths('Empty', '', '0', null, 0, false, [], '1', 'Segments', '00', 'Get_removed.php')];
yield ['', join_paths(null, null, '')];
yield ['1/2/3', join_paths(1, 0, 2, 3)];
yield ['app/objecty', join_paths('app', new class()
{
public function __toString()
{
return 'objecty';
}
})];
yield ['app/0', join_paths('app', new class()
{
public function __toString()
{
return '0';
}
})];
}

#[RequiresOperatingSystem('Windows')]
@@ -32,7 +51,26 @@ public function testItCanMergePathsForWindows(string $expected, string $given)

public static function windowsDataProvider()
{
yield ['app\Http\Kernel.php', join_paths('app', 'Http', 'Kernel.php')];
yield ['app\Http\Kernel.php', join_paths('app', '', 'Http', 'Kernel.php')];
yield ['app\Basic\Functionality.php', join_paths('app', 'Basic', 'Functionality.php')];
yield ['segments\get\ltrimed\by_directory\separator.php', join_paths('segments', '\get\ltrimed', '\by_directory\separator.php')];
yield ['only\\/os_separator/\\/get_ltrimmed.php', join_paths('only', '/os_separator/', '/get_ltrimmed.php')];
yield ['\base_path\\\\does_not\get_trimmed.php', join_paths('\\base_path\\', '\does_not', '\get_trimmed.php')];
yield ['Empty\0\1\Segments\00\Get_removed.php', join_paths('Empty', '', '0', null, 0, false, [], '1', 'Segments', '00', 'Get_removed.php')];
yield ['', join_paths(null, null, '')];
yield ['1\2\3', join_paths(1, 2, 3)];
yield ['app\\objecty', join_paths('app', new class()
{
public function __toString()
{
return 'objecty';
}
})];
yield ['app\\0', join_paths('app', new class()
{
public function __toString()
{
return '0';
}
})];
}
}
29 changes: 29 additions & 0 deletions tests/Foundation/Bootstrap/LoadConfigurationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Illuminate\Tests\Foundation\Bootstrap;

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Bootstrap\LoadConfiguration;
use PHPUnit\Framework\TestCase;

class LoadConfigurationTest extends TestCase
{
public function testLoadsBaseConfiguration()
{
$app = new Application();

(new LoadConfiguration())->bootstrap($app);

$this->assertSame('Laravel', $app['config']['app.name']);
}

public function testDontLoadBaseConfiguration()
{
$app = new Application();
$app->dontMergeFrameworkConfiguration();

(new LoadConfiguration())->bootstrap($app);

$this->assertNull($app['config']['app.name']);
}
}
Loading