updated composer
This commit is contained in:
@@ -44,7 +44,11 @@ trait DetectsLostConnections
|
||||
'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',
|
||||
'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known',
|
||||
'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected',
|
||||
'SQLSTATE[HY000] [2002] Connection timed out',
|
||||
'SSL: Connection timed out',
|
||||
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ class Builder
|
||||
);
|
||||
|
||||
if (! $value instanceof Expression) {
|
||||
$this->addBinding($value, 'where');
|
||||
$this->addBinding($this->flattenValue($value), 'where');
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -1078,7 +1078,7 @@ class Builder
|
||||
|
||||
$this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
|
||||
|
||||
$this->addBinding($this->cleanBindings($values), 'where');
|
||||
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1201,6 +1201,8 @@ class Builder
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
$value = $value->format('Y-m-d');
|
||||
}
|
||||
@@ -1240,6 +1242,8 @@ class Builder
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
$value = $value->format('H:i:s');
|
||||
}
|
||||
@@ -1279,6 +1283,8 @@ class Builder
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
$value = $value->format('d');
|
||||
}
|
||||
@@ -1322,6 +1328,8 @@ class Builder
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
$value = $value->format('m');
|
||||
}
|
||||
@@ -1365,6 +1373,8 @@ class Builder
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
$value = $value->format('Y');
|
||||
}
|
||||
@@ -1673,7 +1683,7 @@ class Builder
|
||||
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
|
||||
|
||||
if (! $value instanceof Expression) {
|
||||
$this->addBinding($value);
|
||||
$this->addBinding((int) $this->flattenValue($value));
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -1822,7 +1832,7 @@ class Builder
|
||||
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
|
||||
|
||||
if (! $value instanceof Expression) {
|
||||
$this->addBinding($value, 'having');
|
||||
$this->addBinding($this->flattenValue($value), 'having');
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -1860,7 +1870,7 @@ class Builder
|
||||
|
||||
$this->havings[] = compact('type', 'column', 'values', 'boolean', 'not');
|
||||
|
||||
$this->addBinding($this->cleanBindings($values), 'having');
|
||||
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having');
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -3082,6 +3092,17 @@ class Builder
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a scalar type value from an unknown type of input.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function flattenValue($value)
|
||||
{
|
||||
return is_array($value) ? head(Arr::flatten($value)) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default key name of the table.
|
||||
*
|
||||
|
||||
@@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '7.30.1';
|
||||
const VERSION = '7.30.4';
|
||||
|
||||
/**
|
||||
* The base path for the Laravel installation.
|
||||
|
||||
@@ -31,7 +31,7 @@ trait InteractsWithContentTypes
|
||||
*/
|
||||
public function isJson()
|
||||
{
|
||||
return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']);
|
||||
return Str::contains($this->header('CONTENT_TYPE') ?? '', ['/json', '+json']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -352,7 +352,7 @@ class Mailer implements MailerContract, MailQueueContract
|
||||
protected function addContent($message, $view, $plain, $raw, $data)
|
||||
{
|
||||
if (isset($view)) {
|
||||
$message->setBody($this->renderView($view, $data), 'text/html');
|
||||
$message->setBody($this->renderView($view, $data) ?: ' ', 'text/html');
|
||||
}
|
||||
|
||||
if (isset($plain)) {
|
||||
|
||||
@@ -1174,7 +1174,7 @@ trait ValidatesAttributes
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! is_scalar($value) && ! method_exists($value, '__toString')) {
|
||||
if (! is_scalar($value) && ! is_null($value) && ! method_exists($value, '__toString')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
2
vendor/laravel/helpers/src/helpers.php
vendored
2
vendor/laravel/helpers/src/helpers.php
vendored
@@ -199,7 +199,7 @@ if (! function_exists('array_prepend')) {
|
||||
*/
|
||||
function array_prepend($array, $value, $key = null)
|
||||
{
|
||||
return Arr::prepend($array, $value, $key);
|
||||
return Arr::prepend(...func_get_args());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class SocialiteManager extends Manager implements Contracts\Factory
|
||||
|
||||
return $this->buildProvider(
|
||||
GitlabProvider::class, $config
|
||||
);
|
||||
)->setHost($config['host'] ?? null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,6 +172,32 @@ class SocialiteManager extends Manager implements Contracts\Factory
|
||||
: $redirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forget all of the resolved driver instances.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forgetDrivers()
|
||||
{
|
||||
$this->drivers = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the container instance used by the manager.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @return $this
|
||||
*/
|
||||
public function setContainer($container)
|
||||
{
|
||||
$this->app = $container;
|
||||
$this->container = $container;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace Laravel\Socialite;
|
||||
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Socialite\Contracts\Factory;
|
||||
|
||||
class SocialiteServiceProvider extends ServiceProvider
|
||||
class SocialiteServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
@@ -28,14 +29,4 @@ class SocialiteServiceProvider extends ServiceProvider
|
||||
{
|
||||
return [Factory::class];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the provider is deferred.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeferred()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,13 @@ abstract class AbstractProvider implements ProviderContract
|
||||
*/
|
||||
protected $stateless = false;
|
||||
|
||||
/**
|
||||
* Indicates if PKCE should be used.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $usesPKCE = false;
|
||||
|
||||
/**
|
||||
* The custom Guzzle configuration options.
|
||||
*
|
||||
@@ -158,6 +165,10 @@ abstract class AbstractProvider implements ProviderContract
|
||||
$this->request->session()->put('state', $state = $this->getState());
|
||||
}
|
||||
|
||||
if ($this->usesPKCE()) {
|
||||
$this->request->session()->put('code_verifier', $codeVerifier = $this->getCodeVerifier());
|
||||
}
|
||||
|
||||
return new RedirectResponse($this->getAuthUrl($state));
|
||||
}
|
||||
|
||||
@@ -192,6 +203,11 @@ abstract class AbstractProvider implements ProviderContract
|
||||
$fields['state'] = $state;
|
||||
}
|
||||
|
||||
if ($this->usesPKCE()) {
|
||||
$fields['code_challenge'] = $this->getCodeChallenge();
|
||||
$fields['code_challenge_method'] = $this->getCodeChallengeMethod();
|
||||
}
|
||||
|
||||
return array_merge($fields, $this->parameters);
|
||||
}
|
||||
|
||||
@@ -284,13 +300,19 @@ abstract class AbstractProvider implements ProviderContract
|
||||
*/
|
||||
protected function getTokenFields($code)
|
||||
{
|
||||
return [
|
||||
$fields = [
|
||||
'grant_type' => 'authorization_code',
|
||||
'client_id' => $this->clientId,
|
||||
'client_secret' => $this->clientSecret,
|
||||
'code' => $code,
|
||||
'redirect_uri' => $this->redirectUrl,
|
||||
];
|
||||
|
||||
if ($this->usesPKCE()) {
|
||||
$fields['code_verifier'] = $this->request->session()->pull('code_verifier');
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,6 +456,60 @@ abstract class AbstractProvider implements ProviderContract
|
||||
return Str::random(40);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the provider uses PKCE.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function usesPKCE()
|
||||
{
|
||||
return $this->usesPKCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables PKCE for the provider.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function enablePKCE()
|
||||
{
|
||||
$this->usesPKCE = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random string of the right length for the PKCE code verifier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getCodeVerifier()
|
||||
{
|
||||
return Str::random(96);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the PKCE code challenge based on the PKCE code verifier in the session.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getCodeChallenge()
|
||||
{
|
||||
$hashed = hash('sha256', $this->request->session()->get('code_verifier'), true);
|
||||
|
||||
return rtrim(strtr(base64_encode($hashed), '+/', '-_'), '=');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hash method used to calculate the PKCE code challenge.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getCodeChallengeMethod()
|
||||
{
|
||||
return 'S256';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the custom parameters of the request.
|
||||
*
|
||||
|
||||
@@ -11,12 +11,41 @@ class GitlabProvider extends AbstractProvider implements ProviderInterface
|
||||
*/
|
||||
protected $scopes = ['read_user'];
|
||||
|
||||
/**
|
||||
* The separating character for the requested scopes.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $scopeSeparator = ' ';
|
||||
|
||||
/**
|
||||
* The Gitlab instance host.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $host = 'https://gitlab.com';
|
||||
|
||||
/**
|
||||
* Set the Gitlab instance host.
|
||||
*
|
||||
* @param string|null $host
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
if (! empty($host)) {
|
||||
$this->host = rtrim($host, '/');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getAuthUrl($state)
|
||||
{
|
||||
return $this->buildAuthUrlFromBase('https://gitlab.com/oauth/authorize', $state);
|
||||
return $this->buildAuthUrlFromBase($this->host.'/oauth/authorize', $state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +53,7 @@ class GitlabProvider extends AbstractProvider implements ProviderInterface
|
||||
*/
|
||||
protected function getTokenUrl()
|
||||
{
|
||||
return 'https://gitlab.com/oauth/token';
|
||||
return $this->host.'/oauth/token';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +61,7 @@ class GitlabProvider extends AbstractProvider implements ProviderInterface
|
||||
*/
|
||||
protected function getUserByToken($token)
|
||||
{
|
||||
$userUrl = 'https://gitlab.com/api/v3/user?access_token='.$token;
|
||||
$userUrl = $this->host.'/api/v3/user?access_token='.$token;
|
||||
|
||||
$response = $this->getHttpClient()->get($userUrl);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user