diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e5a51fc27d..22db3cf52743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,30 @@ # Release Notes for 10.x -## [Unreleased](https://github.com/laravel/framework/compare/v10.37.3...10.x) +## [Unreleased](https://github.com/laravel/framework/compare/v10.38.0...10.x) + +## [v10.38.0](https://github.com/laravel/framework/compare/v10.37.3...v10.38.0) - 2023-12-19 + +* [10.x] Add routeRoute method to test request by [@fragkp](https://github.com/fragkp) in https://github.com/laravel/framework/pull/49366 +* [10.x] Update import & typo by [@chu121su12](https://github.com/chu121su12) in https://github.com/laravel/framework/pull/49370 +* [10.x] Show default `false` values in `db:table` command by [@PerryvanderMeer](https://github.com/PerryvanderMeer) in https://github.com/laravel/framework/pull/49379 +* [10.x] Fix primary key creation for MySQL with `sql_require_primary_key` enabled by [@mtawil](https://github.com/mtawil) in https://github.com/laravel/framework/pull/49374 +* [10.x] Add `charset` and `collation` method to `Blueprint` by [@gcazin](https://github.com/gcazin) in https://github.com/laravel/framework/pull/49396 +* Fixes second run of `about` command on Octane by [@josecl](https://github.com/josecl) in https://github.com/laravel/framework/pull/49387 +* [10.x] Fix bug in ArrayLock getCurrentOwner by [@Joostb](https://github.com/Joostb) in https://github.com/laravel/framework/pull/49393 +* [10.x] Dynamo Batch Repository - Match Default Horizon Sort by [@evan-burrell](https://github.com/evan-burrell) in https://github.com/laravel/framework/pull/49391 +* [10.x] Add Blade `[@session](https://github.com/session)` Directive by [@jrd-lewis](https://github.com/jrd-lewis) in https://github.com/laravel/framework/pull/49339 +* [10.x] Improve `Arr::dot` performance by [@bastien-phi](https://github.com/bastien-phi) in https://github.com/laravel/framework/pull/49386 +* [10.x] Fix assertStatus() parameter order by [@marcovo](https://github.com/marcovo) in https://github.com/laravel/framework/pull/49404 +* [10.x] Only set `defaultCasters` if not previously set by [@inxilpro](https://github.com/inxilpro) in https://github.com/laravel/framework/pull/49402 +* [10.x] Fixes parameter type in `ManagesFrequencies` by [@Lucas-Schmukas](https://github.com/Lucas-Schmukas) in https://github.com/laravel/framework/pull/49399 +* [10.x] Add SQLite support for `whereJsonContains` method by [@danieleambrosino](https://github.com/danieleambrosino) in https://github.com/laravel/framework/pull/49401 +* [10x.] Use native json_validate in Validation by [@gtjamesa](https://github.com/gtjamesa) in https://github.com/laravel/framework/pull/49413 +* [10.x] Introducing `isEmpty` and `isNotEmpty` to `ComponentAttributeBag` by [@devajmeireles](https://github.com/devajmeireles) in https://github.com/laravel/framework/pull/49408 +* [10.x] Drop the primary key if it exists when adding a new primary key by [@KieranFYI](https://github.com/KieranFYI) in https://github.com/laravel/framework/pull/49392 +* [10.x] Improve schema builder `getColumns()` method by [@hafezdivandari](https://github.com/hafezdivandari) in https://github.com/laravel/framework/pull/49416 +* [10.x] Add `MailMessage` helpers for plain text email notifications by [@onlime](https://github.com/onlime) in https://github.com/laravel/framework/pull/49407 +* [10.x] Test Improvements by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/49426 +* [10.x] Add Conditionable to Pipeline by [@shane-zeng](https://github.com/shane-zeng) in https://github.com/laravel/framework/pull/49429 ## [v10.37.3](https://github.com/laravel/framework/compare/v10.37.2...v10.37.3) - 2023-12-13 diff --git a/composer.json b/composer.json index 9e7705b73db9..5af97271ad45 100644 --- a/composer.json +++ b/composer.json @@ -119,12 +119,15 @@ "psr/simple-cache-implementation": "1.0|2.0|3.0" }, "conflict": { + "carbonphp/carbon-doctrine-types": ">=3.0", + "doctrine/dbal": ">=4.0", "tightenco/collect": "<5.5.33" }, "autoload": { "files": [ "src/Illuminate/Collections/helpers.php", "src/Illuminate/Events/functions.php", + "src/Illuminate/Filesystem/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Support/helpers.php" ], diff --git a/src/Illuminate/Console/MigrationGeneratorCommand.php b/src/Illuminate/Console/MigrationGeneratorCommand.php index a3a3e002b675..35e28f0dc68b 100644 --- a/src/Illuminate/Console/MigrationGeneratorCommand.php +++ b/src/Illuminate/Console/MigrationGeneratorCommand.php @@ -5,6 +5,8 @@ use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Composer; +use function Illuminate\Filesystem\join_paths; + abstract class MigrationGeneratorCommand extends Command { /** @@ -114,7 +116,7 @@ protected function replaceMigrationPlaceholders($path, $table) protected function migrationExists($table) { return count($this->files->glob( - $this->laravel->joinPaths($this->laravel->databasePath('migrations'), '*_*_*_*_create_'.$table.'_table.php') + join_paths($this->laravel->databasePath('migrations'), '*_*_*_*_create_'.$table.'_table.php') )) !== 0; } } diff --git a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index aaafa322860f..1f64a7c25aa7 100755 --- a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -406,7 +406,7 @@ public function compileChange(Blueprint $blueprint, Fluent $command, Connection */ public function compilePrimary(Blueprint $blueprint, Fluent $command) { - return sprintf('alter table %s drop index if exists `PRIMARY`, add primary key %s(%s)', + return sprintf('alter table %s add primary key %s(%s)', $this->wrapTable($blueprint), $command->algorithm ? 'using '.$command->algorithm : '', $this->columnize($command->columns) diff --git a/src/Illuminate/Filesystem/composer.json b/src/Illuminate/Filesystem/composer.json index 66925c92b553..2af15697bb47 100644 --- a/src/Illuminate/Filesystem/composer.json +++ b/src/Illuminate/Filesystem/composer.json @@ -24,7 +24,10 @@ "autoload": { "psr-4": { "Illuminate\\Filesystem\\": "" - } + }, + "files": [ + "functions.php" + ] }, "extra": { "branch-alias": { diff --git a/src/Illuminate/Filesystem/functions.php b/src/Illuminate/Filesystem/functions.php new file mode 100644 index 000000000000..47a26fd5eb38 --- /dev/null +++ b/src/Illuminate/Filesystem/functions.php @@ -0,0 +1,25 @@ + $path) { + if (empty($path)) { + unset($paths[$index]); + } else { + $paths[$index] = DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR); + } + } + + return $basePath.implode('', $paths); + } +} diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 7e9a36fe3b11..268912be9b2c 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -29,6 +29,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; +use function Illuminate\Filesystem\join_paths; + class Application extends Container implements ApplicationContract, CachesConfiguration, CachesRoutes, HttpKernelInterface { use Macroable; @@ -38,7 +40,7 @@ class Application extends Container implements ApplicationContract, CachesConfig * * @var string */ - const VERSION = '10.38.0'; + const VERSION = '10.38.1'; /** * The base path for the Laravel installation. @@ -586,7 +588,7 @@ public function viewPath($path = '') */ public function joinPaths($basePath, $path = '') { - return $basePath.($path != '' ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : ''); + return join_paths($basePath, $path); } /** diff --git a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php index a2b2c8c675a9..6717b089d0b6 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php +++ b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -583,7 +583,7 @@ public function call($method, $uri, $parameters = [], $cookies = [], $files = [] ); $response = $kernel->handle( - $request = Request::createFromBase($symfonyRequest) + $request = $this->createTestRequest($symfonyRequest) ); $kernel->terminate($request, $response); @@ -710,6 +710,17 @@ protected function followRedirects($response) return $response; } + /** + * Create the request instance used for testing from the given Symfony request. + * + * @param \Symfony\Component\HttpFoundation\Request $symfonyRequest + * @return \Illuminate\Http\Request + */ + protected function createTestRequest($symfonyRequest) + { + return Request::createFromBase($symfonyRequest); + } + /** * Create the test response instance from the given response. * diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index e3a4019c2c13..fa7960b1cfc8 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -810,6 +810,17 @@ public static function padRight($value, $length, $pad = ' ') */ public static function parseCallback($callback, $default = null) { + if (static::contains($callback, "@anonymous\0")) { + if (static::substrCount($callback, '@') > 1) { + return [ + static::beforeLast($callback, '@'), + static::afterLast($callback, '@'), + ]; + } + + return [$callback, $default]; + } + return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default]; } diff --git a/tests/Database/DatabaseMySqlSchemaGrammarTest.php b/tests/Database/DatabaseMySqlSchemaGrammarTest.php index 7898be1b1d1e..bbe69fb2d466 100755 --- a/tests/Database/DatabaseMySqlSchemaGrammarTest.php +++ b/tests/Database/DatabaseMySqlSchemaGrammarTest.php @@ -345,7 +345,7 @@ public function testAddingPrimaryKey() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table `users` drop index if exists `PRIMARY`, add primary key (`foo`)', $statements[0]); + $this->assertSame('alter table `users` add primary key (`foo`)', $statements[0]); } public function testAddingPrimaryKeyWithAlgorithm() @@ -355,7 +355,7 @@ public function testAddingPrimaryKeyWithAlgorithm() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table `users` drop index if exists `PRIMARY`, add primary key using hash(`foo`)', $statements[0]); + $this->assertSame('alter table `users` add primary key using hash(`foo`)', $statements[0]); } public function testAddingUniqueKey() diff --git a/tests/Filesystem/JoinPathsHelperTest.php b/tests/Filesystem/JoinPathsHelperTest.php new file mode 100644 index 000000000000..2a4d7cf2e089 --- /dev/null +++ b/tests/Filesystem/JoinPathsHelperTest.php @@ -0,0 +1,38 @@ +assertSame($expected, $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')]; + } + + #[RequiresOperatingSystem('Windows')] + #[DataProvider('windowsDataProvider')] + public function testItCanMergePathsForWindows(string $expected, string $given) + { + $this->assertSame($expected, $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')]; + } +} diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index 698ba8bba4ab..04305fd8a912 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -328,9 +328,15 @@ public function testConvertCase() public function testParseCallback() { + $this->assertEquals(['Class', 'method'], Str::parseCallback('Class@method')); $this->assertEquals(['Class', 'method'], Str::parseCallback('Class@method', 'foo')); $this->assertEquals(['Class', 'foo'], Str::parseCallback('Class', 'foo')); $this->assertEquals(['Class', null], Str::parseCallback('Class')); + + $this->assertEquals(["Class@anonymous\0/laravel/382.php:8$2ec", 'method'], Str::parseCallback("Class@anonymous\0/laravel/382.php:8$2ec@method")); + $this->assertEquals(["Class@anonymous\0/laravel/382.php:8$2ec", 'method'], Str::parseCallback("Class@anonymous\0/laravel/382.php:8$2ec@method", 'foo')); + $this->assertEquals(["Class@anonymous\0/laravel/382.php:8$2ec", 'foo'], Str::parseCallback("Class@anonymous\0/laravel/382.php:8$2ec", 'foo')); + $this->assertEquals(["Class@anonymous\0/laravel/382.php:8$2ec", null], Str::parseCallback("Class@anonymous\0/laravel/382.php:8$2ec")); } public function testSlug()