Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Backport some minor fixes #32605

Merged
merged 4 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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