Skip to content

Commit

Permalink
Merge pull request #32605 from laravel/fix-backport
Browse files Browse the repository at this point in the history
[6.x] Backport some minor fixes
  • Loading branch information
taylorotwell authored Apr 30, 2020
2 parents 6c502c1 + 6f1fddd commit 62aea7e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Illuminate/Database/DetectsLostConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function ips()
/**
* Get the client user agent.
*
* @return string
* @return string|null
*/
public function userAgent()
{
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Routing/Matching/HostValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 62aea7e

Please sign in to comment.