From 7e71bdd875f8c69216072d4f5c48c799073f895c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane?= Date: Fri, 11 Sep 2020 18:22:42 +0200 Subject: [PATCH 0001/1276] Changing the dump and restore method for a PostgreSQL database --- src/Illuminate/Database/Console/DumpCommand.php | 2 +- src/Illuminate/Database/Console/Migrations/MigrateCommand.php | 2 +- src/Illuminate/Database/Schema/PostgresSchemaState.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Console/DumpCommand.php b/src/Illuminate/Database/Console/DumpCommand.php index 7662823443e6..ef4c0beb593b 100644 --- a/src/Illuminate/Database/Console/DumpCommand.php +++ b/src/Illuminate/Database/Console/DumpCommand.php @@ -73,7 +73,7 @@ protected function schemaState(Connection $connection) */ protected function path(Connection $connection) { - return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.sql'), function ($path) { + return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.dump'), function ($path) { (new Filesystem)->ensureDirectoryExists(dirname($path)); }); } diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index f547d8d5e80e..0f44d0b61a4e 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -166,6 +166,6 @@ protected function loadSchemaState() */ protected function schemaPath($connection) { - return $this->option('schema-path') ?: database_path('schema/'.$connection->getName().'-schema.sql'); + return $this->option('schema-path') ?: database_path('schema/'.$connection->getName().'-schema.dump'); } } diff --git a/src/Illuminate/Database/Schema/PostgresSchemaState.php b/src/Illuminate/Database/Schema/PostgresSchemaState.php index d7f1d46ae7d4..002795fc1812 100644 --- a/src/Illuminate/Database/Schema/PostgresSchemaState.php +++ b/src/Illuminate/Database/Schema/PostgresSchemaState.php @@ -51,7 +51,7 @@ protected function appendMigrationData(string $path) */ public function load($path) { - $process = $this->makeProcess('PGPASSWORD=$LARAVEL_LOAD_PASSWORD psql --file=$LARAVEL_LOAD_PATH --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE'); + $process = $this->makeProcess('PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH'); $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ 'LARAVEL_LOAD_PATH' => $path, @@ -65,7 +65,7 @@ public function load($path) */ protected function baseDumpCommand() { - return 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_dump --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER $LARAVEL_LOAD_DATABASE'; + return 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_dump -Fc --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER $LARAVEL_LOAD_DATABASE'; } /** From c03f4ff547990737f09fe3ddcf9ef158785f9f7d Mon Sep 17 00:00:00 2001 From: AtCliff_ Date: Tue, 22 Sep 2020 17:41:57 +0300 Subject: [PATCH 0002/1276] Added tg:// protocol in "url" validation rule --- src/Illuminate/Validation/Concerns/ValidatesAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index fe394a2b0638..1621f1e67f69 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -1745,7 +1745,7 @@ public function validateUrl($attribute, $value) * (c) Fabien Potencier http://symfony.com */ $pattern = '~^ - (aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap\+tcp|coap\+ws|coaps|coaps\+tcp|coaps\+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris\.beep|iris\.lwz|iris\.xpc|iris\.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap\.beep|soap\.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|tool|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc\.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s):// # protocol + (aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap\+tcp|coap\+ws|coaps|coaps\+tcp|coaps\+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris\.beep|iris\.lwz|iris\.xpc|iris\.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap\.beep|soap\.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|tg|things|thismessage|tip|tn3270|tool|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc\.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s):// # protocol (((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+)@)? # basic auth ( ([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name From 0fc7847a6f4d4870e6fc254b63cece8f6b35add7 Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Tue, 22 Sep 2020 17:45:21 +0300 Subject: [PATCH 0003/1276] [8.x] update changelog --- CHANGELOG-8.x.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index 3f4502958dd7..3ca54c773293 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -1,6 +1,22 @@ # Release Notes for 8.x -## [Unreleased](https://github.com/laravel/framework/compare/v8.3.0...8.x) +## [Unreleased](https://github.com/laravel/framework/compare/v8.4.0...8.x) + + +## [v8.4.0 (2020-09-16)](https://github.com/laravel/framework/compare/v8.3.0...v8.4.0) + +### Added +- Added SQLite schema dump support ([#34323](https://github.com/laravel/framework/pull/34323)) +- Added `queue:clear` command ([#34330](https://github.com/laravel/framework/pull/34330), [06b378c](https://github.com/laravel/framework/commit/06b378c07b2ea989aa3e947ca003e96ea277153c)) + +### Fixed +- Fixed `minimal.blade.php` ([#34379](https://github.com/laravel/framework/pull/34379)) +- Dont double escape on ComponentTagCompiler.php ([ec75487](https://github.com/laravel/framework/commit/ec75487062506963dd27a4302fe3680c0e3681a3)) +- Fixed dots in attribute names in `DynamicComponent` ([2d1d962](https://github.com/laravel/framework/commit/2d1d96272a94bce123676ed742af2d80ba628ba4)) + +### Changed +- Show warning when view exists when using artisan `make:component` ([#34376](https://github.com/laravel/framework/pull/34376), [0ce75e0](https://github.com/laravel/framework/commit/0ce75e01a66ba4b13bbe4cbed85564f1dc76bb05)) +- Call the booting/booted callbacks from the container ([#34370](https://github.com/laravel/framework/pull/34370)) ## [v8.3.0 (2020-09-15)](https://github.com/laravel/framework/compare/v8.2.0...v8.3.0) From e14a49aa7d1da253810d17076fa96b157b4f1b8c Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Tue, 22 Sep 2020 18:02:04 +0300 Subject: [PATCH 0004/1276] [7.x] update changelog --- CHANGELOG-7.x.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-7.x.md b/CHANGELOG-7.x.md index 9652d7ec3d04..4733c9751ddd 100644 --- a/CHANGELOG-7.x.md +++ b/CHANGELOG-7.x.md @@ -1,6 +1,12 @@ # Release Notes for 7.x -## [Unreleased](https://github.com/laravel/framework/compare/v7.28.2...7.x) +## [Unreleased](https://github.com/laravel/framework/compare/v7.28.3...7.x) + + +## [v7.28.3 (2020-09-17)](https://github.com/laravel/framework/compare/v7.28.2...v7.28.3) + +### Fixed +- Fixed problems with dots in validator ([#34355](https://github.com/laravel/framework/pull/34355)) ## [v7.28.2 (2020-09-15)](https://github.com/laravel/framework/compare/v7.28.1...v7.28.2) From e84bb7fa63c6b96d20529a74f972a28d5e8448bd Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Tue, 22 Sep 2020 18:13:51 +0300 Subject: [PATCH 0005/1276] [8.x] update changelog --- CHANGELOG-8.x.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index 3ca54c773293..58d27b3e2bbd 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -1,6 +1,20 @@ # Release Notes for 8.x -## [Unreleased](https://github.com/laravel/framework/compare/v8.4.0...8.x) +## [Unreleased](https://github.com/laravel/framework/compare/v8.5.0...8.x) + + +## [v8.5.0 (2020-09-19)](https://github.com/laravel/framework/compare/v8.4.0...v8.5.0) + +### Added +- Allow clearing an SQS queue by `queue:clear` command ([#34383](https://github.com/laravel/framework/pull/34383), [de811ea](https://github.com/laravel/framework/commit/de811ea7f7dc7ecfc686b25fba48e4b0dac473e6)) +- Added `Illuminate\Foundation\Auth\EmailVerificationRequest` ([4bde31b](https://github.com/laravel/framework/commit/4bde31b24bf01b4d4a35ad31fafd8e4ca203b0f2)) +- Auto handle `Jsonable` values passed to `castAsJson()` ([#34392](https://github.com/laravel/framework/pull/34392)) +- Added crossJoinSub method to the query builder ([#34400](https://github.com/laravel/framework/pull/34400)) +- Added `Illuminate\Session\Store::passwordConfirmed()` ([fb3f45a](https://github.com/laravel/framework/commit/fb3f45aa0142764c5c29b97e8bcf8328091986e9)) + +### Changed +- check for view existence first in `Illuminate\Mail\Markdown::render()` ([5f78c90](https://github.com/laravel/framework/commit/5f78c90a7af118dd07703a78da06586016973a66)) +- Guess the model name when using the make:factory command ([#34373](https://github.com/laravel/framework/pull/34373)) ## [v8.4.0 (2020-09-16)](https://github.com/laravel/framework/compare/v8.3.0...v8.4.0) From b8d1f28450c53ff7173c5cfeda4f1b6ffbf4b034 Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Tue, 22 Sep 2020 18:25:41 +0300 Subject: [PATCH 0006/1276] [8.x] update changelog --- CHANGELOG-8.x.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index 58d27b3e2bbd..b79b522172a0 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -1,6 +1,20 @@ # Release Notes for 8.x -## [Unreleased](https://github.com/laravel/framework/compare/v8.5.0...8.x) +## [Unreleased](https://github.com/laravel/framework/compare/v8.6.0...8.x) + + +## [v8.6.0 (2020-09-22)](https://github.com/laravel/framework/compare/v8.5.0...v8.6.0) + +### Added +- Added `Illuminate\Collections\LazyCollection::takeUntilTimeout()` ([0aabf24](https://github.com/laravel/framework/commit/0aabf2472850a9d573907ca092bf5e3cfe26fab3)) +- Added `--schema-path` option to `migrate:fresh` command ([#34419](https://github.com/laravel/framework/pull/34419)) + +### Fixed +- Fixed problems with dots in validator ([#34355](https://github.com/laravel/framework/pull/34355)) +- Maintenance mode: Fix empty Retry-After header ([#34412](https://github.com/laravel/framework/pull/34412)) +- Fixed bug with error handling in closure scheduled tasks ([#34420](https://github.com/laravel/framework/pull/34420)) +- Dont double escape on ComponentTagCompiler.php ([12ba0d9](https://github.com/laravel/framework/commit/12ba0d937d54e81eccf8f0a80150f0d70604e1c2)) +- Fixed `mysqldump: unknown variable 'column-statistics=0` for MariaDB schema dump ([#34442](https://github.com/laravel/framework/pull/34442)) ## [v8.5.0 (2020-09-19)](https://github.com/laravel/framework/compare/v8.4.0...v8.5.0) From 1fc4f2d46747e6c8b5f425dc6e17e82ad9094b8c Mon Sep 17 00:00:00 2001 From: iamgergo Date: Tue, 22 Sep 2020 18:15:30 +0200 Subject: [PATCH 0007/1276] [8.x] Fix Logger docblocks --- src/Illuminate/Log/Events/MessageLogged.php | 2 +- src/Illuminate/Log/Logger.php | 24 ++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Illuminate/Log/Events/MessageLogged.php b/src/Illuminate/Log/Events/MessageLogged.php index 312b343a356d..8ecf14793992 100644 --- a/src/Illuminate/Log/Events/MessageLogged.php +++ b/src/Illuminate/Log/Events/MessageLogged.php @@ -29,7 +29,7 @@ class MessageLogged * Create a new event instance. * * @param string $level - * @param string $message + * @param mixed $message * @param array $context * @return void */ diff --git a/src/Illuminate/Log/Logger.php b/src/Illuminate/Log/Logger.php index e5a8de6287f9..c22d96be22cc 100755 --- a/src/Illuminate/Log/Logger.php +++ b/src/Illuminate/Log/Logger.php @@ -42,7 +42,7 @@ public function __construct(LoggerInterface $logger, Dispatcher $dispatcher = nu /** * Log an emergency message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -54,7 +54,7 @@ public function emergency($message, array $context = []) /** * Log an alert message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -66,7 +66,7 @@ public function alert($message, array $context = []) /** * Log a critical message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -78,7 +78,7 @@ public function critical($message, array $context = []) /** * Log an error message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -90,7 +90,7 @@ public function error($message, array $context = []) /** * Log a warning message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -102,7 +102,7 @@ public function warning($message, array $context = []) /** * Log a notice to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -114,7 +114,7 @@ public function notice($message, array $context = []) /** * Log an informational message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -126,7 +126,7 @@ public function info($message, array $context = []) /** * Log a debug message to the logs. * - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -139,7 +139,7 @@ public function debug($message, array $context = []) * Log a message to the logs. * * @param string $level - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -152,7 +152,7 @@ public function log($level, $message, array $context = []) * Dynamically pass log calls into the writer. * * @param string $level - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -165,7 +165,7 @@ public function write($level, $message, array $context = []) * Write a message to the log. * * @param string $level - * @param string $message + * @param mixed $message * @param array $context * @return void */ @@ -197,7 +197,7 @@ public function listen(Closure $callback) * Fires a log event. * * @param string $level - * @param string $message + * @param mixed $message * @param array $context * @return void */ From 285ef1c4b039f846c6683b2ccb80c3fb1b234aec Mon Sep 17 00:00:00 2001 From: iamgergo Date: Tue, 22 Sep 2020 18:17:56 +0200 Subject: [PATCH 0008/1276] Fix docblocks again --- src/Illuminate/Log/Events/MessageLogged.php | 2 +- src/Illuminate/Log/Logger.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Log/Events/MessageLogged.php b/src/Illuminate/Log/Events/MessageLogged.php index 8ecf14793992..312b343a356d 100644 --- a/src/Illuminate/Log/Events/MessageLogged.php +++ b/src/Illuminate/Log/Events/MessageLogged.php @@ -29,7 +29,7 @@ class MessageLogged * Create a new event instance. * * @param string $level - * @param mixed $message + * @param string $message * @param array $context * @return void */ diff --git a/src/Illuminate/Log/Logger.php b/src/Illuminate/Log/Logger.php index c22d96be22cc..5465a2b4eda3 100755 --- a/src/Illuminate/Log/Logger.php +++ b/src/Illuminate/Log/Logger.php @@ -197,7 +197,7 @@ public function listen(Closure $callback) * Fires a log event. * * @param string $level - * @param mixed $message + * @param string $message * @param array $context * @return void */ From ccbf7ae8802ec70afc1f2428b26309cfe8059971 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 23 Sep 2020 09:33:20 +0200 Subject: [PATCH 0009/1276] [6.x] Add support for stream reads Backport https://github.com/laravel/framework/pull/34001 --- src/Illuminate/Filesystem/FilesystemManager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 3dacc2b10aa4..8c24488abb95 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -207,9 +207,11 @@ public function createS3Driver(array $config) $root = $s3Config['root'] ?? null; $options = $config['options'] ?? []; + + $streamReads = $config['stream_reads'] ?? false; return $this->adapt($this->createFlysystem( - new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options), $config + new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options, $streamReads), $config )); } From bb352e939e98e8bf77f35070586439a16c2ebe8b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 23 Sep 2020 09:35:10 +0200 Subject: [PATCH 0010/1276] Update FilesystemManager.php --- src/Illuminate/Filesystem/FilesystemManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 8c24488abb95..6003ac6b9634 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -207,7 +207,7 @@ public function createS3Driver(array $config) $root = $s3Config['root'] ?? null; $options = $config['options'] ?? []; - + $streamReads = $config['stream_reads'] ?? false; return $this->adapt($this->createFlysystem( From 11914f7c222c44e2c4c57acc13508c990269c5a0 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 23 Sep 2020 09:09:27 +0100 Subject: [PATCH 0011/1276] Revert "[8.x] Fix Logger docblocks" --- src/Illuminate/Log/Logger.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Illuminate/Log/Logger.php b/src/Illuminate/Log/Logger.php index 5465a2b4eda3..e5a8de6287f9 100755 --- a/src/Illuminate/Log/Logger.php +++ b/src/Illuminate/Log/Logger.php @@ -42,7 +42,7 @@ public function __construct(LoggerInterface $logger, Dispatcher $dispatcher = nu /** * Log an emergency message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -54,7 +54,7 @@ public function emergency($message, array $context = []) /** * Log an alert message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -66,7 +66,7 @@ public function alert($message, array $context = []) /** * Log a critical message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -78,7 +78,7 @@ public function critical($message, array $context = []) /** * Log an error message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -90,7 +90,7 @@ public function error($message, array $context = []) /** * Log a warning message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -102,7 +102,7 @@ public function warning($message, array $context = []) /** * Log a notice to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -114,7 +114,7 @@ public function notice($message, array $context = []) /** * Log an informational message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -126,7 +126,7 @@ public function info($message, array $context = []) /** * Log a debug message to the logs. * - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -139,7 +139,7 @@ public function debug($message, array $context = []) * Log a message to the logs. * * @param string $level - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -152,7 +152,7 @@ public function log($level, $message, array $context = []) * Dynamically pass log calls into the writer. * * @param string $level - * @param mixed $message + * @param string $message * @param array $context * @return void */ @@ -165,7 +165,7 @@ public function write($level, $message, array $context = []) * Write a message to the log. * * @param string $level - * @param mixed $message + * @param string $message * @param array $context * @return void */ From c8fa0cce6cd1815660f60abdcc99474b0f2b0f93 Mon Sep 17 00:00:00 2001 From: Nabih NADHIF Date: Wed, 23 Sep 2020 15:13:54 +0200 Subject: [PATCH 0012/1276] =?UTF-8?q?=F0=9F=90=9B=20Fix=20incompatibility?= =?UTF-8?q?=20with=20Lumen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lumen $request->route() signature is different from Illuminate\Http\Request::route --- src/Illuminate/Session/Middleware/StartSession.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Session/Middleware/StartSession.php b/src/Illuminate/Session/Middleware/StartSession.php index 955486f2f6c3..c702d920473b 100644 --- a/src/Illuminate/Session/Middleware/StartSession.php +++ b/src/Illuminate/Session/Middleware/StartSession.php @@ -5,6 +5,7 @@ use Closure; use Illuminate\Contracts\Session\Session; use Illuminate\Http\Request; +use Illuminate\Routing\Route; use Illuminate\Session\SessionManager; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Date; @@ -56,7 +57,7 @@ public function handle($request, Closure $next) $session = $this->getSession($request); if ($this->manager->shouldBlock() || - ($request->route() && $request->route()->locksFor())) { + ($request->route() instanceof Route && $request->route()->locksFor())) { return $this->handleRequestWhileBlocking($request, $session, $next); } else { return $this->handleStatefulRequest($request, $session, $next); @@ -73,6 +74,10 @@ public function handle($request, Closure $next) */ protected function handleRequestWhileBlocking(Request $request, $session, Closure $next) { + if (! $request->route() instanceof Route) { + return; + } + $lockFor = $request->route() && $request->route()->locksFor() ? $request->route()->locksFor() : 10; @@ -195,7 +200,7 @@ protected function configHitsLottery(array $config) protected function storeCurrentUrl(Request $request, $session) { if ($request->method() === 'GET' && - $request->route() && + $request->route() instanceof Route && ! $request->ajax() && ! $request->prefetch()) { $session->setPreviousUrl($request->fullUrl()); From 6321ae0cd77c055ced5646516228ca5f5aacf372 Mon Sep 17 00:00:00 2001 From: btaskew Date: Wed, 23 Sep 2020 14:20:03 +0100 Subject: [PATCH 0013/1276] Allow dynamic factory methods to obey newFactory method on model --- src/Illuminate/Database/Eloquent/Factories/Factory.php | 6 +++--- tests/Database/DatabaseEloquentFactoryTest.php | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Factories/Factory.php b/src/Illuminate/Database/Eloquent/Factories/Factory.php index 665ef399efa2..121c89006cb6 100644 --- a/src/Illuminate/Database/Eloquent/Factories/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factories/Factory.php @@ -705,9 +705,9 @@ public function __call($method, $parameters) $relationship = Str::camel(Str::substr($method, 3)); - $factory = static::factoryForModel( - get_class($this->newModel()->{$relationship}()->getRelated()) - ); + $relationshipClass = get_class($this->newModel()->{$relationship}()->getRelated()); + + $factory = $relationshipClass::newFactory() ?: static::factoryForModel($relationshipClass); if (Str::startsWith($method, 'for')) { return $this->for($factory->state($parameters[0] ?? []), $relationship); diff --git a/tests/Database/DatabaseEloquentFactoryTest.php b/tests/Database/DatabaseEloquentFactoryTest.php index fd4c064c33bd..8df70dc7fb98 100644 --- a/tests/Database/DatabaseEloquentFactoryTest.php +++ b/tests/Database/DatabaseEloquentFactoryTest.php @@ -399,6 +399,8 @@ public function definition() class FactoryTestPost extends Eloquent { + use HasFactory; + protected $table = 'posts'; public function user() @@ -433,6 +435,8 @@ public function definition() class FactoryTestComment extends Eloquent { + use HasFactory; + protected $table = 'comments'; public function commentable() @@ -455,6 +459,8 @@ public function definition() class FactoryTestRole extends Eloquent { + use HasFactory; + protected $table = 'roles'; public function users() From a4e2ac20a6e8e24676bd9c9d68642f3e588eabf9 Mon Sep 17 00:00:00 2001 From: Blake Patton Date: Wed, 23 Sep 2020 08:02:06 -0700 Subject: [PATCH 0014/1276] Remove DANGEROUS cascade statement from truncate query --- src/Illuminate/Database/Query/Grammars/PostgresGrammar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 46420bb6a596..6192e4b4db65 100755 --- a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -318,7 +318,7 @@ protected function compileDeleteWithJoinsOrLimit(Builder $query) */ public function compileTruncate(Builder $query) { - return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; + return ['truncate '.$this->wrapTable($query->from).' restart identity' => []]; } /** From ee0bb7ab141ff80166cc9ac9f57184eac5153dc0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 23 Sep 2020 10:05:46 -0500 Subject: [PATCH 0015/1276] Revert "Revert cascading truncations" --- src/Illuminate/Database/Query/Grammars/PostgresGrammar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 6192e4b4db65..46420bb6a596 100755 --- a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -318,7 +318,7 @@ protected function compileDeleteWithJoinsOrLimit(Builder $query) */ public function compileTruncate(Builder $query) { - return ['truncate '.$this->wrapTable($query->from).' restart identity' => []]; + return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; } /** From 9c6653e43d374ca301e68c77a760cb9f62377b59 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Wed, 23 Sep 2020 17:29:32 +0200 Subject: [PATCH 0016/1276] Allow modifiers in createFromFormat() --- .../Database/Eloquent/Concerns/HasAttributes.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 498e87195adc..a4ec0952eda4 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -3,6 +3,7 @@ namespace Illuminate\Database\Eloquent\Concerns; use Carbon\CarbonInterface; +use Carbon\Exceptions\InvalidFormatException; use DateTimeInterface; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes; @@ -912,11 +913,13 @@ protected function asDateTime($value) // Finally, we will just assume this date is in the format used by default on // the database connection and use that format to create the Carbon object // that is returned back out to the developers after we convert it here. - if (Date::hasFormat($value, $format)) { - return Date::createFromFormat($format, $value); + try { + $date = Date::createFromFormat($format, $value); + } catch (InvalidFormatException $_) { + $date = false; } - return Date::parse($value); + return $date ?: Date::parse($value); } /** From 9b8f94e7561cd2548522983c37411b3f04f73c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 23 Sep 2020 18:40:53 +0200 Subject: [PATCH 0017/1276] Allow for dynamic calls of anonymous component with varied attributes, add regression test --- src/Illuminate/View/DynamicComponent.php | 15 ++------------- tests/Integration/View/BladeTest.php | 13 +++++++++++++ .../templates/components/hello-span.blade.php | 7 +++++++ .../View/templates/varied-dynamic-calls.blade.php | 2 ++ 4 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 tests/Integration/View/templates/components/hello-span.blade.php create mode 100644 tests/Integration/View/templates/varied-dynamic-calls.blade.php diff --git a/src/Illuminate/View/DynamicComponent.php b/src/Illuminate/View/DynamicComponent.php index 793c34e05241..7133f4f29af7 100644 --- a/src/Illuminate/View/DynamicComponent.php +++ b/src/Illuminate/View/DynamicComponent.php @@ -29,13 +29,6 @@ class DynamicComponent extends Component */ protected static $componentClasses = []; - /** - * The cached binding keys for component classes. - * - * @var array - */ - protected static $bindings = []; - /** * Create a new component instance. * @@ -153,13 +146,9 @@ protected function classForComponent() */ protected function bindings(string $class) { - if (! isset(static::$bindings[$class])) { - [$data, $attributes] = $this->compiler()->partitionDataAndAttributes($class, $this->attributes->getAttributes()); - - static::$bindings[$class] = array_keys($data->all()); - } + [$data, $attributes] = $this->compiler()->partitionDataAndAttributes($class, $this->attributes->getAttributes()); - return static::$bindings[$class]; + return array_keys($data->all()); } /** diff --git a/tests/Integration/View/BladeTest.php b/tests/Integration/View/BladeTest.php index 5f4b3d10ab0b..36f47e8e5056 100644 --- a/tests/Integration/View/BladeTest.php +++ b/tests/Integration/View/BladeTest.php @@ -35,6 +35,19 @@ public function test_rendering_a_dynamic_component() ', trim($view)); } + public function test_rendering_the_same_dynamic_component_with_different_attributes() + { + $view = View::make('varied-dynamic-calls')->render(); + + $this->assertEquals(' + Hello Taylor + + + + Hello Samuel +', trim($view)); + } + protected function getEnvironmentSetUp($app) { $app['config']->set('view.paths', [__DIR__.'/templates']); diff --git a/tests/Integration/View/templates/components/hello-span.blade.php b/tests/Integration/View/templates/components/hello-span.blade.php new file mode 100644 index 000000000000..fac695a4acbf --- /dev/null +++ b/tests/Integration/View/templates/components/hello-span.blade.php @@ -0,0 +1,7 @@ +@props([ + 'name', +]) + + + Hello {{ $name }} + diff --git a/tests/Integration/View/templates/varied-dynamic-calls.blade.php b/tests/Integration/View/templates/varied-dynamic-calls.blade.php new file mode 100644 index 000000000000..5b267ca4d906 --- /dev/null +++ b/tests/Integration/View/templates/varied-dynamic-calls.blade.php @@ -0,0 +1,2 @@ + + From 9cc2622a9122f5108a694856055c13db8a5f80dc Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 23 Sep 2020 13:30:25 -0500 Subject: [PATCH 0018/1276] add no-reload option --- src/Illuminate/Foundation/Console/ServeCommand.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index ab4cb2ef2874..e9ae5f11cdcd 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -61,7 +61,9 @@ public function handle() clearstatcache(false, $environmentFile); } - if ($hasEnvironment && filemtime($environmentFile) > $environmentLastModified) { + if (! $this->option('no-reload') && + $hasEnvironment && + filemtime($environmentFile) > $environmentLastModified) { $environmentLastModified = filemtime($environmentFile); $this->comment('Environment modified. Restarting server...'); @@ -93,6 +95,10 @@ public function handle() protected function startProcess() { $process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) { + if ($this->option('no-reload')) { + return [$key => $value]; + } + return $key === 'APP_ENV' ? [$key => $value] : [$key => false]; @@ -164,6 +170,7 @@ protected function getOptions() ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'], ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')], ['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10], + ['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'], ]; } } From 94ad84680a190dc8a213a0a3947f4c3419bd06e2 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Wed, 23 Sep 2020 22:32:53 +0200 Subject: [PATCH 0019/1276] Fix error catch to handle older Carbon versions --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index a4ec0952eda4..3e59501fd065 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -15,6 +15,7 @@ use Illuminate\Support\Collection as BaseCollection; use Illuminate\Support\Facades\Date; use Illuminate\Support\Str; +use InvalidArgumentException; use LogicException; trait HasAttributes @@ -915,7 +916,7 @@ protected function asDateTime($value) // that is returned back out to the developers after we convert it here. try { $date = Date::createFromFormat($format, $value); - } catch (InvalidFormatException $_) { + } catch (InvalidFormatException | InvalidArgumentException $_) { $date = false; } From 647d226715f9600e0e61f36f33e1465eff535524 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Wed, 23 Sep 2020 23:43:34 +0200 Subject: [PATCH 0020/1276] Add test to show the handle of special formats --- .../DatabaseEloquentIntegrationTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/Database/DatabaseEloquentIntegrationTest.php b/tests/Database/DatabaseEloquentIntegrationTest.php index db36f33c6ccc..bf304590b83b 100644 --- a/tests/Database/DatabaseEloquentIntegrationTest.php +++ b/tests/Database/DatabaseEloquentIntegrationTest.php @@ -1413,6 +1413,34 @@ public function testTimestampsUsingOldSqlServerDateFormatFallbackToDefaultParsin $this->assertFalse(Date::hasFormat('2017-11-14 08:23:19.734', $model->getDateFormat())); } + public function testSpecialFormats() + { + $model = new EloquentTestUser; + $model->setDateFormat('!Y-d-m \\Y'); + $model->setRawAttributes([ + 'updated_at' => '2017-05-11 Y', + ]); + + $date = $model->getAttribute('updated_at'); + $this->assertSame('2017-11-05 00:00:00.000000', $date->format('Y-m-d H:i:s.u'), 'the date should respect the whole format'); + + $model->setDateFormat('Y d m|'); + $model->setRawAttributes([ + 'updated_at' => '2020 11 09', + ]); + + $date = $model->getAttribute('updated_at'); + $this->assertSame('2020-09-11 00:00:00.000000', $date->format('Y-m-d H:i:s.u'), 'the date should respect the whole format'); + + $model->setDateFormat('Y d m|*'); + $model->setRawAttributes([ + 'updated_at' => '2020 11 09 foo', + ]); + + $date = $model->getAttribute('updated_at'); + $this->assertSame('2020-09-11 00:00:00.000000', $date->format('Y-m-d H:i:s.u'), 'the date should respect the whole format'); + } + public function testUpdatingChildModelTouchesParent() { $before = Carbon::now(); From 56a0a254ab639d793ddec71c38bb4870744ce3f0 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Thu, 24 Sep 2020 00:06:29 +0200 Subject: [PATCH 0021/1276] Use only root type in exception catch --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 3e59501fd065..010bf9351ae5 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -916,7 +916,7 @@ protected function asDateTime($value) // that is returned back out to the developers after we convert it here. try { $date = Date::createFromFormat($format, $value); - } catch (InvalidFormatException | InvalidArgumentException $_) { + } catch (InvalidArgumentException $_) { $date = false; } From 3fbceab1836a8581393b67de88fbf95c640b18b3 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Thu, 24 Sep 2020 00:16:26 +0200 Subject: [PATCH 0022/1276] Cleanup import --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 010bf9351ae5..f036ef2835ea 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -3,7 +3,6 @@ namespace Illuminate\Database\Eloquent\Concerns; use Carbon\CarbonInterface; -use Carbon\Exceptions\InvalidFormatException; use DateTimeInterface; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes; From 70a73ab5984f7641f18f43fd39d40dc77a99eb30 Mon Sep 17 00:00:00 2001 From: btaskew Date: Thu, 24 Sep 2020 08:11:16 +0100 Subject: [PATCH 0023/1276] Check for method existence --- src/Illuminate/Database/Eloquent/Factories/Factory.php | 4 +++- tests/Database/DatabaseEloquentFactoryTest.php | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Factories/Factory.php b/src/Illuminate/Database/Eloquent/Factories/Factory.php index 121c89006cb6..20bb924c0daf 100644 --- a/src/Illuminate/Database/Eloquent/Factories/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factories/Factory.php @@ -707,7 +707,9 @@ public function __call($method, $parameters) $relationshipClass = get_class($this->newModel()->{$relationship}()->getRelated()); - $factory = $relationshipClass::newFactory() ?: static::factoryForModel($relationshipClass); + $factory = method_exists($relationshipClass, 'newFactory') && $relationshipClass::newFactory() + ? $relationshipClass::newFactory() + : static::factoryForModel($relationshipClass); if (Str::startsWith($method, 'for')) { return $this->for($factory->state($parameters[0] ?? []), $relationship); diff --git a/tests/Database/DatabaseEloquentFactoryTest.php b/tests/Database/DatabaseEloquentFactoryTest.php index 8df70dc7fb98..fd4c064c33bd 100644 --- a/tests/Database/DatabaseEloquentFactoryTest.php +++ b/tests/Database/DatabaseEloquentFactoryTest.php @@ -399,8 +399,6 @@ public function definition() class FactoryTestPost extends Eloquent { - use HasFactory; - protected $table = 'posts'; public function user() @@ -435,8 +433,6 @@ public function definition() class FactoryTestComment extends Eloquent { - use HasFactory; - protected $table = 'comments'; public function commentable() @@ -459,8 +455,6 @@ public function definition() class FactoryTestRole extends Eloquent { - use HasFactory; - protected $table = 'roles'; public function users() From b084985496bc4ea227d77e17d7105c3b317b0467 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 24 Sep 2020 13:26:40 +0200 Subject: [PATCH 0024/1276] Use letter abbreviation over undescore Co-authored-by: Dries Vints --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index f036ef2835ea..655f1018a504 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -915,7 +915,7 @@ protected function asDateTime($value) // that is returned back out to the developers after we convert it here. try { $date = Date::createFromFormat($format, $value); - } catch (InvalidArgumentException $_) { + } catch (InvalidArgumentException $e) { $date = false; } From 4708e9ef8f7cde617a5820f07cfd350daaba0e0f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 24 Sep 2020 08:39:24 -0500 Subject: [PATCH 0025/1276] formatting --- src/Illuminate/Database/Eloquent/Factories/Factory.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Factories/Factory.php b/src/Illuminate/Database/Eloquent/Factories/Factory.php index 20bb924c0daf..ee0e74440719 100644 --- a/src/Illuminate/Database/Eloquent/Factories/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factories/Factory.php @@ -705,11 +705,13 @@ public function __call($method, $parameters) $relationship = Str::camel(Str::substr($method, 3)); - $relationshipClass = get_class($this->newModel()->{$relationship}()->getRelated()); + $relatedModel = get_class($this->newModel()->{$relationship}()->getRelated()); - $factory = method_exists($relationshipClass, 'newFactory') && $relationshipClass::newFactory() - ? $relationshipClass::newFactory() - : static::factoryForModel($relationshipClass); + if (method_exists($relatedModel, 'newFactory')) { + $factory = $relatedModel::newFactory() ?: static::factoryForModel($relatedModel); + } else { + $factory = static::factoryForModel($relatedModel); + } if (Str::startsWith($method, 'for')) { return $this->for($factory->state($parameters[0] ?? []), $relationship); From 87e6a786fe83b738eb42e16374e24f78ddb1a8af Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Thu, 24 Sep 2020 19:21:48 +0200 Subject: [PATCH 0026/1276] Fix misspelling: dont -> don't --- CHANGELOG-8.x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index b79b522172a0..071ca1fc82ea 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -13,7 +13,7 @@ - Fixed problems with dots in validator ([#34355](https://github.com/laravel/framework/pull/34355)) - Maintenance mode: Fix empty Retry-After header ([#34412](https://github.com/laravel/framework/pull/34412)) - Fixed bug with error handling in closure scheduled tasks ([#34420](https://github.com/laravel/framework/pull/34420)) -- Dont double escape on ComponentTagCompiler.php ([12ba0d9](https://github.com/laravel/framework/commit/12ba0d937d54e81eccf8f0a80150f0d70604e1c2)) +- Don't double escape on ComponentTagCompiler.php ([12ba0d9](https://github.com/laravel/framework/commit/12ba0d937d54e81eccf8f0a80150f0d70604e1c2)) - Fixed `mysqldump: unknown variable 'column-statistics=0` for MariaDB schema dump ([#34442](https://github.com/laravel/framework/pull/34442)) From 540df3f62c70bc8470269141f9636e52166c9694 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Thu, 24 Sep 2020 19:25:16 +0200 Subject: [PATCH 0027/1276] Revert "Update config.yml (#32757)" This reverts commit af5c1d2e2ed730c48a7a6be053c2ba33fb19b77c. --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 1f878f8a09da..00e38a2dce3f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: Feature request - url: https://github.com/laravel/framework/discussions/new - about: 'For ideas or feature requests' + url: https://github.com/laravel/ideas/issues + about: 'For ideas or feature requests, open up an issue on the Laravel ideas repository' - name: Support Questions & Other - url: https://github.com/laravel/framework/discussions/new - about: 'If you have a question or need help using the library' + url: https://laravel.com/docs/contributions#support-questions + about: 'This repository is only for reporting bugs. If you have a question or need help using the library, click:' - name: Documentation issue url: https://github.com/laravel/docs about: For documentation issues, open a pull request at the laravel/docs repository From f27e340f8a8b34b22edff1b2486e71c03065040f Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 13:59:49 -0400 Subject: [PATCH 0028/1276] Cast model id's to string for models containing the string keyType --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 22d1d4d2c1a2..f71b3b44d4d9 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -136,7 +136,7 @@ protected function getResultsByType($type) $whereIn = $this->whereInMethod($instance, $ownerKey); return $query->{$whereIn}( - $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) + $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type, $instance->getKeyType()) )->get(); } @@ -144,10 +144,15 @@ protected function getResultsByType($type) * Gather all of the foreign keys for a given type. * * @param string $type + * @param string $keyType * @return array */ - protected function gatherKeysByType($type) + protected function gatherKeysByType($type, $keyType) { + if ( $keyType === 'string' ) { + return array_map(function($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); + } + return array_keys($this->dictionary[$type]); } From 9fd47f396505ddaa9c1bb0104e0c185b08476f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AA?= Date: Thu, 24 Sep 2020 21:03:22 +0300 Subject: [PATCH 0029/1276] Add perHour and perDay methods to RateLimiting I have found my self using rate-limiting with hours and days quite often, in API subscriptions to be precise. --- src/Illuminate/Cache/RateLimiting/Limit.php | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Illuminate/Cache/RateLimiting/Limit.php b/src/Illuminate/Cache/RateLimiting/Limit.php index 2eee661b25ce..ab3463f51830 100644 --- a/src/Illuminate/Cache/RateLimiting/Limit.php +++ b/src/Illuminate/Cache/RateLimiting/Limit.php @@ -58,6 +58,30 @@ public static function perMinute($maxAttempts) return new static('', $maxAttempts); } + /** + * Create a new rate limit using hours as decay time. + * + * @param int $maxAttempts + * @param int $decayHours + * @return static + */ + public static function perHour($maxAttempts, $decayHours = 1) + { + return new static('', $maxAttempts, 60 * $decayHours); + } + + /** + * Create a new rate limit using days as decay time. + * + * @param int $maxAttempts + * @param int $decayDays + * @return static + */ + public static function perDay($maxAttempts, $decayDays = 1) + { + return new static('', $maxAttempts, 60 * 24 * $decayDays); + } + /** * Create a new unlimited rate limit. * From 025bb34c9a54560235d12c0c4886f6bf76aa21d0 Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 14:20:46 -0400 Subject: [PATCH 0030/1276] style fixes --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index f71b3b44d4d9..30a35a73d68e 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -150,7 +150,9 @@ protected function getResultsByType($type) protected function gatherKeysByType($type, $keyType) { if ( $keyType === 'string' ) { - return array_map(function($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); + return array_map(function ($modelId) { + return (string) $modelId; + }, array_keys($this->dictionary[$type])); } return array_keys($this->dictionary[$type]); From 5813b00cbe85d88d47bf14de594240785f36acd9 Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 14:21:34 -0400 Subject: [PATCH 0031/1276] style fix --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 30a35a73d68e..9fc03bb88165 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -149,7 +149,7 @@ protected function getResultsByType($type) */ protected function gatherKeysByType($type, $keyType) { - if ( $keyType === 'string' ) { + if ($keyType === 'string') { return array_map(function ($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); From c3f44c712833d83061452e9a362a5e10fa424863 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 24 Sep 2020 14:38:19 -0500 Subject: [PATCH 0032/1276] cast to string if key type is string --- .../Database/Eloquent/Relations/MorphTo.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 9fc03bb88165..1f2f11ef73aa 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -149,13 +149,11 @@ protected function getResultsByType($type) */ protected function gatherKeysByType($type, $keyType) { - if ($keyType === 'string') { - return array_map(function ($modelId) { - return (string) $modelId; - }, array_keys($this->dictionary[$type])); - } - - return array_keys($this->dictionary[$type]); + return $keyType !== 'string' + ? array_keys($this->dictionary[$type]) + : array_map(function ($modelId) { + return (string) $modelId; + }, array_keys($this->dictionary[$type])); } /** From ecee467480c25ffa58b0c732098a488fd353d5c5 Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 13:59:49 -0400 Subject: [PATCH 0033/1276] Cast model id's to string for models containing the string keyType --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 22d1d4d2c1a2..f71b3b44d4d9 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -136,7 +136,7 @@ protected function getResultsByType($type) $whereIn = $this->whereInMethod($instance, $ownerKey); return $query->{$whereIn}( - $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) + $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type, $instance->getKeyType()) )->get(); } @@ -144,10 +144,15 @@ protected function getResultsByType($type) * Gather all of the foreign keys for a given type. * * @param string $type + * @param string $keyType * @return array */ - protected function gatherKeysByType($type) + protected function gatherKeysByType($type, $keyType) { + if ( $keyType === 'string' ) { + return array_map(function($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); + } + return array_keys($this->dictionary[$type]); } From c2e1eec758fa7614567566075c1d8c0a0d446bb2 Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 14:20:46 -0400 Subject: [PATCH 0034/1276] style fixes --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index f71b3b44d4d9..30a35a73d68e 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -150,7 +150,9 @@ protected function getResultsByType($type) protected function gatherKeysByType($type, $keyType) { if ( $keyType === 'string' ) { - return array_map(function($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); + return array_map(function ($modelId) { + return (string) $modelId; + }, array_keys($this->dictionary[$type])); } return array_keys($this->dictionary[$type]); From 9d557e07f1d6a766db94dc5ab30d6af52c11ef98 Mon Sep 17 00:00:00 2001 From: Jim Peters Date: Thu, 24 Sep 2020 14:21:34 -0400 Subject: [PATCH 0035/1276] style fix --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 30a35a73d68e..9fc03bb88165 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -149,7 +149,7 @@ protected function getResultsByType($type) */ protected function gatherKeysByType($type, $keyType) { - if ( $keyType === 'string' ) { + if ($keyType === 'string') { return array_map(function ($modelId) { return (string) $modelId; }, array_keys($this->dictionary[$type])); From c652cdd05e805d8cb26e093f9cf303dd1dd42383 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 24 Sep 2020 14:38:19 -0500 Subject: [PATCH 0036/1276] cast to string if key type is string --- .../Database/Eloquent/Relations/MorphTo.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 9fc03bb88165..1f2f11ef73aa 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -149,13 +149,11 @@ protected function getResultsByType($type) */ protected function gatherKeysByType($type, $keyType) { - if ($keyType === 'string') { - return array_map(function ($modelId) { - return (string) $modelId; - }, array_keys($this->dictionary[$type])); - } - - return array_keys($this->dictionary[$type]); + return $keyType !== 'string' + ? array_keys($this->dictionary[$type]) + : array_map(function ($modelId) { + return (string) $modelId; + }, array_keys($this->dictionary[$type])); } /** From 06ddd7c7f350d4b4b9cfacf04b87d57f76c7d909 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 24 Sep 2020 14:39:09 -0500 Subject: [PATCH 0037/1276] Apply fixes from StyleCI (#34533) --- src/Illuminate/Database/Eloquent/Relations/MorphTo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 1f2f11ef73aa..891c172dff69 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -152,8 +152,8 @@ protected function gatherKeysByType($type, $keyType) return $keyType !== 'string' ? array_keys($this->dictionary[$type]) : array_map(function ($modelId) { - return (string) $modelId; - }, array_keys($this->dictionary[$type])); + return (string) $modelId; + }, array_keys($this->dictionary[$type])); } /** From f3707046a65f6390f5f19047f8693ac58b9e0c28 Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Fri, 25 Sep 2020 11:08:55 +0200 Subject: [PATCH 0038/1276] Fix 2 small issues in change log Change word: dont -> don't Capitalize first word in sentence --- CHANGELOG-8.x.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-8.x.md b/CHANGELOG-8.x.md index 071ca1fc82ea..dda40d83906a 100644 --- a/CHANGELOG-8.x.md +++ b/CHANGELOG-8.x.md @@ -27,7 +27,7 @@ - Added `Illuminate\Session\Store::passwordConfirmed()` ([fb3f45a](https://github.com/laravel/framework/commit/fb3f45aa0142764c5c29b97e8bcf8328091986e9)) ### Changed -- check for view existence first in `Illuminate\Mail\Markdown::render()` ([5f78c90](https://github.com/laravel/framework/commit/5f78c90a7af118dd07703a78da06586016973a66)) +- Check for view existence first in `Illuminate\Mail\Markdown::render()` ([5f78c90](https://github.com/laravel/framework/commit/5f78c90a7af118dd07703a78da06586016973a66)) - Guess the model name when using the make:factory command ([#34373](https://github.com/laravel/framework/pull/34373)) @@ -39,7 +39,7 @@ ### Fixed - Fixed `minimal.blade.php` ([#34379](https://github.com/laravel/framework/pull/34379)) -- Dont double escape on ComponentTagCompiler.php ([ec75487](https://github.com/laravel/framework/commit/ec75487062506963dd27a4302fe3680c0e3681a3)) +- Don't double escape on ComponentTagCompiler.php ([ec75487](https://github.com/laravel/framework/commit/ec75487062506963dd27a4302fe3680c0e3681a3)) - Fixed dots in attribute names in `DynamicComponent` ([2d1d962](https://github.com/laravel/framework/commit/2d1d96272a94bce123676ed742af2d80ba628ba4)) ### Changed From ff0c19f82fc52f2802e34e33f05370e43cbdd2c5 Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Fri, 25 Sep 2020 11:41:31 +0200 Subject: [PATCH 0039/1276] Change word dont - > don't --- CHANGELOG-6.x.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-6.x.md b/CHANGELOG-6.x.md index 09aae92bdff2..3d774a432c43 100644 --- a/CHANGELOG-6.x.md +++ b/CHANGELOG-6.x.md @@ -49,7 +49,7 @@ ### Fixed - Fixed `Illuminate\Support\Arr::query()` ([c6f9ae2](https://github.com/laravel/framework/commit/c6f9ae2b6fdc3c1716938223de731b97f6a5a255)) -- Dont allow mass filling with table names ([9240404](https://github.com/laravel/framework/commit/9240404b22ef6f9e827577b3753e4713ddce7471), [f5fa6e3](https://github.com/laravel/framework/commit/f5fa6e3a0fbf9a93eab45b9ae73265b4dbfc3ad7)) +- Don't allow mass filling with table names ([9240404](https://github.com/laravel/framework/commit/9240404b22ef6f9e827577b3753e4713ddce7471), [f5fa6e3](https://github.com/laravel/framework/commit/f5fa6e3a0fbf9a93eab45b9ae73265b4dbfc3ad7)) ## [v6.18.33 (2020-08-06)](https://github.com/laravel/framework/compare/v6.18.32...v6.18.33) @@ -93,7 +93,7 @@ ## [v6.18.27 (2020-07-27)](https://github.com/laravel/framework/compare/v6.18.26...v6.18.27) ### Fixed -- Dont decrement transaction below 0 in `Illuminate\Database\Concerns\ManagesTransactions::handleCommitTransactionException()` ([7681795](https://github.com/laravel/framework/commit/768179578e5492b5f80c391bd43b233938e16e27)) +- Don't decrement transaction below 0 in `Illuminate\Database\Concerns\ManagesTransactions::handleCommitTransactionException()` ([7681795](https://github.com/laravel/framework/commit/768179578e5492b5f80c391bd43b233938e16e27)) - Fixed transaction problems on closure transaction ([c4cdfc7](https://github.com/laravel/framework/commit/c4cdfc7c54127b772ef10f37cfc9ef8e9d6b3227)) - Prevent to serialize uninitialized properties ([#33644](https://github.com/laravel/framework/pull/33644)) - Fixed missing statement preventing deletion in `Illuminate\Database\Eloquent\Relations\MorphPivot::delete()` ([#33648](https://github.com/laravel/framework/pull/33648)) @@ -442,7 +442,7 @@ ### Changed - Use SKIP LOCKED for mysql 8.1 and pgsql 9.5 queue workers ([#31287](https://github.com/laravel/framework/pull/31287)) -- Dont merge middleware from method and property in `Illuminate\Bus\Queueable::middleware()` ([#31301](https://github.com/laravel/framework/pull/31301)) +- Don't merge middleware from method and property in `Illuminate\Bus\Queueable::middleware()` ([#31301](https://github.com/laravel/framework/pull/31301)) - Split `specifyParameter()` from `Illuminate\Console\Command` to `HasParameters` trait ([#31254](https://github.com/laravel/framework/pull/31254)) - Make sure changing a database field to json does not include charset ([#31343](https://github.com/laravel/framework/pull/31343)) @@ -581,7 +581,7 @@ - Fixed `Builder::withCount()` binding error when a scope is added into related model with binding in a sub-select ([#30869](https://github.com/laravel/framework/pull/30869)) ### Changed -- Dont throw exception when session is not set in `AuthenticateSession` middleware ([4de1d24](https://github.com/laravel/framework/commit/4de1d24cf390f07d4f503973e5556f73060fbb31)) +- Don't throw exception when session is not set in `AuthenticateSession` middleware ([4de1d24](https://github.com/laravel/framework/commit/4de1d24cf390f07d4f503973e5556f73060fbb31)) ## [v6.8.0 (2019-12-17)](https://github.com/laravel/framework/compare/v6.7.0...v6.8.0) From 20ff6a5db22f6cc8f971a715f09ee65e11bf4adc Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Fri, 25 Sep 2020 11:46:41 +0200 Subject: [PATCH 0040/1276] Fix small issues with CHANGELOG-7.xmd Capitalize first word in sentence, 2 times Change dont -> don't, 3 times --- CHANGELOG-7.x.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG-7.x.md b/CHANGELOG-7.x.md index 4733c9751ddd..851fe0d663dd 100644 --- a/CHANGELOG-7.x.md +++ b/CHANGELOG-7.x.md @@ -44,7 +44,7 @@ - RefreshDatabase migration commands parameters moved to methods ([#34007](https://github.com/laravel/framework/pull/34007), [8b35c8e](https://github.com/laravel/framework/commit/8b35c8e6ba5879e71fd81fd03b5687ee2b46c55a), [256f71c](https://github.com/laravel/framework/commit/256f71c1f81da2d4bb3e327b18389ac43fa97a72)) ### Changed -- allow to reset forced scheme and root-url in UrlGenerator ([#34039](https://github.com/laravel/framework/pull/34039)) +- Allow to reset forced scheme and root-url in UrlGenerator ([#34039](https://github.com/laravel/framework/pull/34039)) - Updating the make commands to use a custom views path ([#34060](https://github.com/laravel/framework/pull/34060), [b593c62](https://github.com/laravel/framework/commit/b593c6242942623fcc12638d0390da7c58dbbb11)) - Using "public static property" in View Component causes an error ([#34058](https://github.com/laravel/framework/pull/34058)) - Changed postgres processor ([#34055](https://github.com/laravel/framework/pull/34055)) @@ -121,7 +121,7 @@ ### Fixed - Fixed `Illuminate\Support\Arr::query()` ([c6f9ae2](https://github.com/laravel/framework/commit/c6f9ae2b6fdc3c1716938223de731b97f6a5a255)) -- Dont allow mass filling with table names ([9240404](https://github.com/laravel/framework/commit/9240404b22ef6f9e827577b3753e4713ddce7471), [f5fa6e3](https://github.com/laravel/framework/commit/f5fa6e3a0fbf9a93eab45b9ae73265b4dbfc3ad7)) +- Don't allow mass filling with table names ([9240404](https://github.com/laravel/framework/commit/9240404b22ef6f9e827577b3753e4713ddce7471), [f5fa6e3](https://github.com/laravel/framework/commit/f5fa6e3a0fbf9a93eab45b9ae73265b4dbfc3ad7)) ## [v7.23.1 (2020-08-06)](https://github.com/laravel/framework/compare/v7.23.0...v7.23.1) @@ -179,7 +179,7 @@ ### Fixed - Prevent usage of get*AtColumn() when model has no timestamps ([#33634](https://github.com/laravel/framework/pull/33634)) -- Dont decrement transaction below 0 in `Illuminate\Database\Concerns\ManagesTransactions::handleCommitTransactionException()` ([7681795](https://github.com/laravel/framework/commit/768179578e5492b5f80c391bd43b233938e16e27)) +- Don't decrement transaction below 0 in `Illuminate\Database\Concerns\ManagesTransactions::handleCommitTransactionException()` ([7681795](https://github.com/laravel/framework/commit/768179578e5492b5f80c391bd43b233938e16e27)) - Fixed transaction problems on closure transaction ([c4cdfc7](https://github.com/laravel/framework/commit/c4cdfc7c54127b772ef10f37cfc9ef8e9d6b3227)) - Prevent to serialize uninitialized properties ([#33644](https://github.com/laravel/framework/pull/33644)) - Fixed missing statement preventing deletion in `Illuminate\Database\Eloquent\Relations\MorphPivot::delete()` ([#33648](https://github.com/laravel/framework/pull/33648)) @@ -394,7 +394,7 @@ - Fixed `Illuminate\Cache\ArrayStore::increment()` bug that changes expiration to forever ([#32875](https://github.com/laravel/framework/pull/32875)) ### Changed -- Dont cache non objects in `Illuminate/Database/Eloquent/Concerns/HasAttributes::getClassCastableAttributeValue()` ([894fe22](https://github.com/laravel/framework/commit/894fe22c6c111b224de5bada24dcbba4c93f0305)) +- Don't cache non objects in `Illuminate/Database/Eloquent/Concerns/HasAttributes::getClassCastableAttributeValue()` ([894fe22](https://github.com/laravel/framework/commit/894fe22c6c111b224de5bada24dcbba4c93f0305)) - Added explicit `symfony/polyfill-php73` dependency ([5796b1e](https://github.com/laravel/framework/commit/5796b1e43dfe14914050a7e5dd24ddf803ec99b8)) - Set `Cache\FileStore` file permissions only once ([#32845](https://github.com/laravel/framework/pull/32845), [11c533b](https://github.com/laravel/framework/commit/11c533b9aa062f4cba1dd0fe3673bf33d275480f)) - Added alias as key of package's view components ([#32863](https://github.com/laravel/framework/pull/32863)) @@ -885,7 +885,7 @@ - Fixed `trim` of the prefix in the `CompiledRouteCollection::newRoute()` ([ce0355c](https://github.com/laravel/framework/commit/ce0355c72bf4defb93ae80c7bf7812bd6532031a), [b842c65](https://github.com/laravel/framework/commit/b842c65ecfe1ea7839d61a46b177b6b5887fd4d2)) ### Changed -- remove comments before compiling components in the `BladeCompiler` ([2964d2d](https://github.com/laravel/framework/commit/2964d2dfd3cc50f7a709effee0af671c86587915)) +- Remove comments before compiling components in the `BladeCompiler` ([2964d2d](https://github.com/laravel/framework/commit/2964d2dfd3cc50f7a709effee0af671c86587915)) ## [v7.0.1 (2020-03-03)](https://github.com/laravel/framework/compare/v7.0.0...v7.0.1) From 2ec773802f75c20926a27b8b308b3ea2f13b8d7c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 25 Sep 2020 08:07:42 -0500 Subject: [PATCH 0041/1276] set no timeout --- src/Illuminate/Database/Schema/MySqlSchemaState.php | 2 +- src/Illuminate/Database/Schema/PostgresSchemaState.php | 2 +- src/Illuminate/Database/Schema/SqliteSchemaState.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Database/Schema/MySqlSchemaState.php b/src/Illuminate/Database/Schema/MySqlSchemaState.php index 3cb7dc93b250..fa5ce7bc5f67 100644 --- a/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ b/src/Illuminate/Database/Schema/MySqlSchemaState.php @@ -116,7 +116,7 @@ protected function baseVariables(array $config) protected function executeDumpProcess(Process $process, $output, array $variables) { try { - $process->mustRun($output, $variables); + $process->setTimeout(null)->mustRun($output, $variables); } catch (Exception $e) { if (Str::contains($e->getMessage(), ['column-statistics', 'column_statistics'])) { return $this->executeDumpProcess(Process::fromShellCommandLine( diff --git a/src/Illuminate/Database/Schema/PostgresSchemaState.php b/src/Illuminate/Database/Schema/PostgresSchemaState.php index 81fef2632a8a..2d1857941fb3 100644 --- a/src/Illuminate/Database/Schema/PostgresSchemaState.php +++ b/src/Illuminate/Database/Schema/PostgresSchemaState.php @@ -31,7 +31,7 @@ protected function appendMigrationData(string $path) { with($process = $this->makeProcess( $this->baseDumpCommand().' --table=migrations --data-only --inserts' - ))->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ + ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ // ])); diff --git a/src/Illuminate/Database/Schema/SqliteSchemaState.php b/src/Illuminate/Database/Schema/SqliteSchemaState.php index 773affb2ccf2..8f6487cad529 100644 --- a/src/Illuminate/Database/Schema/SqliteSchemaState.php +++ b/src/Illuminate/Database/Schema/SqliteSchemaState.php @@ -15,7 +15,7 @@ public function dump($path) { with($process = $this->makeProcess( $this->baseCommand().' .schema' - ))->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ + ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ // ])); From c131f471af6e3a45593adbe0ed3bbea074f85500 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Sun, 27 Sep 2020 12:33:36 +1000 Subject: [PATCH 0042/1276] Add throwWith to the HTTP client response Because: - There is a repeated pattern where you want to perform a particular action if the response has failed, such as logging the error. ```php // before... $response = $client->withHeaders($headers)->post($url, $payload); if ($response->failed()) { Log::error('Twitter API failed posting Tweet', [ 'url' => $url, 'payload' => $payload, 'headers' => $headers, 'response' => $response->body(), ]); $response->throw(); } return $response->json(); // after... return $client->withHeaders($headers) ->post($url, $payload) ->throwWith(fn ($response) => Log::error('Twitter API failed posting Tweet', [ 'url' => $url, 'payload' => $payload, 'headers' => $headers, 'response' => $response->body(), ]) )->json(); ``` This commit: - Adds the `throwWith` method to the response. - Updates the `throw` method to utilise the new `throwWith` method, just with an empty closure. Notes: - I'm not convinced this is the best name for this method. - I'm also wondering if the method should be a `tap` method of some kind. `tapWhenThrowing` or something along those lines. --- src/Illuminate/Http/Client/Response.php | 17 ++++++++++++ tests/Http/HttpClientTest.php | 36 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/Illuminate/Http/Client/Response.php b/src/Illuminate/Http/Client/Response.php index 2a34b5f83fef..a66575e89269 100644 --- a/src/Illuminate/Http/Client/Response.php +++ b/src/Illuminate/Http/Client/Response.php @@ -208,8 +208,25 @@ public function toPsrResponse() * @throws \Illuminate\Http\Client\RequestException */ public function throw() + { + return $this->throwWith(function () { + // + }); + } + + /** + * Execute the callback and throw an exception if a server of client error occurred. + * + * @param \Closure $callback + * @return $this + * + * @throws \Illuminate\Http\Client\RequestException + */ + public function throwWith($callback) { if ($this->serverError() || $this->clientError()) { + $callback($this); + throw new RequestException($this); } diff --git a/tests/Http/HttpClientTest.php b/tests/Http/HttpClientTest.php index 45aae46c950e..739657a7d79c 100644 --- a/tests/Http/HttpClientTest.php +++ b/tests/Http/HttpClientTest.php @@ -476,6 +476,42 @@ public function testRequestExceptionEmptyBody() throw new RequestException(new Response($response)); } + public function testThrowWithCallsClosureOnError() + { + $status = 0; + $client = $this->factory->fake([ + 'laravel.com' => $this->factory::response('', 401), + ]); + $response = $client->get('laravel.com'); + + try { + $response->throwWith(function ($response) use (&$status) { + $status = $response->status(); + }); + } catch (RequestException $e) { + // + } + + $this->assertSame(401, $status); + $this->assertSame(401, $response->status()); + } + + public function testThrowWithDoesntCallClosureOnSuccess() + { + $status = 0; + $client = $this->factory->fake([ + 'laravel.com' => $this->factory::response('', 201), + ]); + $response = $client->get('laravel.com'); + + $response->throwWith(function ($response) use (&$status) { + $status = $response->status(); + }); + + $this->assertSame(0, $status); + $this->assertSame(201, $response->status()); + } + public function testSinkToFile() { $this->factory->fakeSequence()->push('abc123'); From 571b36fdbd3087ec5facf134b46e42cc736c984e Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 28 Sep 2020 19:59:15 +1000 Subject: [PATCH 0043/1276] Implement `onError` instead of the combined `throwWith` method Because: - There wasn't a great name that really expressed what was happening under the hood, i.e. running the closure and throwing the exception This commit: - Reverts the `throw` method and implements a stand-alone `onError` method --- src/Illuminate/Http/Client/Response.php | 14 ++--- tests/Http/HttpClientTest.php | 74 ++++++++++++++++++++----- 2 files changed, 65 insertions(+), 23 deletions(-) diff --git a/src/Illuminate/Http/Client/Response.php b/src/Illuminate/Http/Client/Response.php index a66575e89269..f93dc6c753b2 100644 --- a/src/Illuminate/Http/Client/Response.php +++ b/src/Illuminate/Http/Client/Response.php @@ -209,9 +209,11 @@ public function toPsrResponse() */ public function throw() { - return $this->throwWith(function () { - // - }); + if ($this->serverError() || $this->clientError()) { + throw new RequestException($this); + } + + return $this; } /** @@ -219,15 +221,11 @@ public function throw() * * @param \Closure $callback * @return $this - * - * @throws \Illuminate\Http\Client\RequestException */ - public function throwWith($callback) + public function onError($callback) { if ($this->serverError() || $this->clientError()) { $callback($this); - - throw new RequestException($this); } return $this; diff --git a/tests/Http/HttpClientTest.php b/tests/Http/HttpClientTest.php index 739657a7d79c..6a599b2fdb6d 100644 --- a/tests/Http/HttpClientTest.php +++ b/tests/Http/HttpClientTest.php @@ -476,42 +476,86 @@ public function testRequestExceptionEmptyBody() throw new RequestException(new Response($response)); } - public function testThrowWithCallsClosureOnError() + public function testOnErrorDoesntCallClosureOnInformational() { $status = 0; $client = $this->factory->fake([ - 'laravel.com' => $this->factory::response('', 401), + 'laravel.com' => $this->factory::response('', 101), ]); - $response = $client->get('laravel.com'); - try { - $response->throwWith(function ($response) use (&$status) { + $response = $client->get('laravel.com') + ->onError(function ($response) use (&$status) { $status = $response->status(); }); - } catch (RequestException $e) { - // - } - $this->assertSame(401, $status); - $this->assertSame(401, $response->status()); + $this->assertSame(0, $status); + $this->assertSame(101, $response->status()); } - public function testThrowWithDoesntCallClosureOnSuccess() + public function testOnErrorDoesntCallClosureOnSuccess() { $status = 0; $client = $this->factory->fake([ 'laravel.com' => $this->factory::response('', 201), ]); - $response = $client->get('laravel.com'); - $response->throwWith(function ($response) use (&$status) { - $status = $response->status(); - }); + $response = $client->get('laravel.com') + ->onError(function ($response) use (&$status) { + $status = $response->status(); + }); $this->assertSame(0, $status); $this->assertSame(201, $response->status()); } + public function testOnErrorDoesntCallClosureOnRedirection() + { + $status = 0; + $client = $this->factory->fake([ + 'laravel.com' => $this->factory::response('', 301), + ]); + + $response = $client->get('laravel.com') + ->onError(function ($response) use (&$status) { + $status = $response->status(); + }); + + $this->assertSame(0, $status); + $this->assertSame(301, $response->status()); + } + + public function testOnErrorCallsClosureOnClientError() + { + $status = 0; + $client = $this->factory->fake([ + 'laravel.com' => $this->factory::response('', 401), + ]); + + $response = $client->get('laravel.com') + ->onError(function ($response) use (&$status) { + $status = $response->status(); + }); + + $this->assertSame(401, $status); + $this->assertSame(401, $response->status()); + } + + public function testOnErrorCallsClosureOnServerError() + { + $status = 0; + $client = $this->factory->fake([ + 'laravel.com' => $this->factory::response('', 501), + ]); + + $response = $client->get('laravel.com') + ->onError(function ($response) use (&$status) { + $status = $response->status(); + }); + + $this->assertSame(501, $status); + $this->assertSame(501, $response->status()); + } + public function testSinkToFile() { $this->factory->fakeSequence()->push('abc123'); From f4867e65a61477af8591466bf238eacd75208dec Mon Sep 17 00:00:00 2001 From: Gerard Lamusse Date: Mon, 28 Sep 2020 14:03:44 +0200 Subject: [PATCH 0044/1276] [8.x] Change to X-Message-ID in Mailgun and Ses Transport (#34567) * Change to X-Message-ID in mail transport * Fixed incorrect usage of addTextHeader * Updated test for 'X-Message-ID' * Updated test for X-Message-ID in SesTransport * Fixed code syntax * Update MailgunTransport.php * Update SesTransport.php * Update MailSesTransportTest.php Co-authored-by: Taylor Otwell --- src/Illuminate/Mail/Transport/MailgunTransport.php | 7 ++++--- src/Illuminate/Mail/Transport/SesTransport.php | 5 ++++- tests/Mail/MailSesTransportTest.php | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Mail/Transport/MailgunTransport.php b/src/Illuminate/Mail/Transport/MailgunTransport.php index 195c00032464..1c862b1a7f30 100644 --- a/src/Illuminate/Mail/Transport/MailgunTransport.php +++ b/src/Illuminate/Mail/Transport/MailgunTransport.php @@ -72,9 +72,10 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul $this->payload($message, $to) ); - $message->getHeaders()->addTextHeader( - 'X-Mailgun-Message-ID', $this->getMessageId($response) - ); + $messageId = $this->getMessageId($response); + + $message->getHeaders()->addTextHeader('X-Message-ID', $messageId); + $message->getHeaders()->addTextHeader('X-Mailgun-Message-ID', $messageId); $message->setBcc($bcc); diff --git a/src/Illuminate/Mail/Transport/SesTransport.php b/src/Illuminate/Mail/Transport/SesTransport.php index 0dc8584a4edc..76eb2a8a03c3 100644 --- a/src/Illuminate/Mail/Transport/SesTransport.php +++ b/src/Illuminate/Mail/Transport/SesTransport.php @@ -52,7 +52,10 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul ) ); - $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId')); + $messageId = $result->get('MessageId'); + + $message->getHeaders()->addTextHeader('X-Message-ID', $messageId); + $message->getHeaders()->addTextHeader('X-SES-Message-ID', $messageId); $this->sendPerformed($message); diff --git a/tests/Mail/MailSesTransportTest.php b/tests/Mail/MailSesTransportTest.php index 3e32c55d3646..90c5540f2de0 100644 --- a/tests/Mail/MailSesTransportTest.php +++ b/tests/Mail/MailSesTransportTest.php @@ -52,7 +52,7 @@ public function testSend() $transport = new SesTransport($client); // Generate a messageId for our mock to return to ensure that the post-sent message - // has X-SES-Message-ID in its headers + // has X-Message-ID in its headers $messageId = Str::random(32); $sendRawEmailMock = new sendRawEmailMock($messageId); $client->expects($this->once()) @@ -64,6 +64,8 @@ public function testSend() ->willReturn($sendRawEmailMock); $transport->send($message); + + $this->assertEquals($messageId, $message->getHeaders()->get('X-Message-ID')->getFieldBody()); $this->assertEquals($messageId, $message->getHeaders()->get('X-SES-Message-ID')->getFieldBody()); } } From e63abd8d372f9bad3ca95570cb7e603f3ef28bdc Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 28 Sep 2020 16:22:16 +0300 Subject: [PATCH 0045/1276] Fixed translation label ("Pagination Navigation") (#34568) --- src/Illuminate/Pagination/resources/views/tailwind.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Pagination/resources/views/tailwind.blade.php b/src/Illuminate/Pagination/resources/views/tailwind.blade.php index c4c5a8bc2b5d..2f5eca93e152 100644 --- a/src/Illuminate/Pagination/resources/views/tailwind.blade.php +++ b/src/Illuminate/Pagination/resources/views/tailwind.blade.php @@ -1,5 +1,5 @@ @if ($paginator->hasPages()) -