From 96a48ab07391909f5a091cb200366ce12e00da2a Mon Sep 17 00:00:00 2001 From: Pierre Grimaud Date: Sat, 18 Apr 2020 22:43:34 +0200 Subject: [PATCH 1/4] Fix typos --- src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | 2 +- src/Illuminate/Database/Query/Builder.php | 4 ++-- tests/Database/DatabaseEloquentBuilderTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 9fb153be7a13..986e8a72121f 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -351,7 +351,7 @@ public function getAttributeValue($key) } // If the attribute exists within the cast array, we will convert it to - // an appropriate native PHP type dependant upon the associated value + // an appropriate native PHP type dependent upon the associated value // given with the key in the pair. Dayle made this comment line up. if ($this->hasCast($key)) { return $this->castAttribute($key, $value); diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 3e488526edaa..5b3990ddfa2a 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -2331,9 +2331,9 @@ protected function stripTableForPluck($column) return $column; } - $seperator = strpos(strtolower($column), ' as ') !== false ? ' as ' : '\.'; + $separator = strpos(strtolower($column), ' as ') !== false ? ' as ' : '\.'; - return last(preg_split('~'.$seperator.'~i', $column)); + return last(preg_split('~'.$separator.'~i', $column)); } /** diff --git a/tests/Database/DatabaseEloquentBuilderTest.php b/tests/Database/DatabaseEloquentBuilderTest.php index d772a8477a30..8276ea03e96b 100755 --- a/tests/Database/DatabaseEloquentBuilderTest.php +++ b/tests/Database/DatabaseEloquentBuilderTest.php @@ -836,7 +836,7 @@ public function testHasWithConstraintsWithOrWhereAndHavingInSubquery() $this->assertEquals(['larry', '90210', '90220', 'fooside dr', 29], $builder->getBindings()); } - public function testHasWithContraintsAndJoinAndHavingInSubquery() + public function testHasWithConstraintsAndJoinAndHavingInSubquery() { $model = new EloquentBuilderTestModelParentStub; $builder = $model->where('bar', 'baz'); From 6974a9995327b57148bef1e4f671cdd3eea5bb3e Mon Sep 17 00:00:00 2001 From: Nguyen You Date: Sat, 4 Apr 2020 22:11:11 +0700 Subject: [PATCH 2/4] [7.x] Removed double getHostRegex() call (#32229) * reduce unnecessary method calls * Update HostValidator.php Co-authored-by: Graham Campbell --- src/Illuminate/Routing/Matching/HostValidator.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Routing/Matching/HostValidator.php b/src/Illuminate/Routing/Matching/HostValidator.php index 76f9d878ec04..a0ea7210cb54 100644 --- a/src/Illuminate/Routing/Matching/HostValidator.php +++ b/src/Illuminate/Routing/Matching/HostValidator.php @@ -16,10 +16,12 @@ class HostValidator implements ValidatorInterface */ public function matches(Route $route, Request $request) { - if (is_null($route->getCompiled()->getHostRegex())) { + $hostRegex = $route->getCompiled()->getHostRegex(); + + if (is_null($hostRegex)) { return true; } - return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); + return preg_match($hostRegex, $request->getHost()); } } From 419b847bb41a68e29131b65a18817af6ab6cc474 Mon Sep 17 00:00:00 2001 From: baijunyao Date: Wed, 29 Apr 2020 14:11:49 +0800 Subject: [PATCH 3/4] Fix `userAgent()` return type --- src/Illuminate/Http/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 0c9bfa6b005f..a4018c5c2174 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -294,7 +294,7 @@ public function ips() /** * Get the client user agent. * - * @return string + * @return string|null */ public function userAgent() { From 6f1fdddc9c9afc571f3aca51a67b58828a9e35f7 Mon Sep 17 00:00:00 2001 From: IanBrison Date: Sat, 25 Apr 2020 21:41:41 +0900 Subject: [PATCH 4/4] Add pdo try again as lost connection message --- src/Illuminate/Database/DetectsLostConnections.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Database/DetectsLostConnections.php b/src/Illuminate/Database/DetectsLostConnections.php index 63b3b297b163..dd376159603f 100644 --- a/src/Illuminate/Database/DetectsLostConnections.php +++ b/src/Illuminate/Database/DetectsLostConnections.php @@ -43,6 +43,7 @@ protected function causedByLostConnection(Throwable $e) 'Connection refused', 'running with the --read-only option so it cannot execute this statement', 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', + 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', ]); } }