composeer update
This commit is contained in:
+31
-4
@@ -155,8 +155,9 @@ class SerializableClosure implements Serializable
|
||||
'self' => $this->reference,
|
||||
));
|
||||
|
||||
if(static::$securityProvider !== null){
|
||||
$ret = '@' . json_encode(static::$securityProvider->sign($ret));
|
||||
if (static::$securityProvider !== null) {
|
||||
$data = static::$securityProvider->sign($ret);
|
||||
$ret = '@' . $data['hash'] . '.' . $data['closure'];
|
||||
}
|
||||
|
||||
if (!--$this->scope->serializations && !--$this->scope->toserialize) {
|
||||
@@ -193,7 +194,20 @@ class SerializableClosure implements Serializable
|
||||
"Make sure you use a security provider for both serialization and unserialization.");
|
||||
}
|
||||
|
||||
$data = json_decode(substr($data, 1), true);
|
||||
if ($data[1] !== '{') {
|
||||
$separator = strpos($data, '.');
|
||||
if ($separator === false) {
|
||||
throw new SecurityException('Invalid signed closure');
|
||||
}
|
||||
$hash = substr($data, 1, $separator - 1);
|
||||
$closure = substr($data, $separator + 1);
|
||||
|
||||
$data = ['hash' => $hash, 'closure' => $closure];
|
||||
|
||||
unset($hash, $closure);
|
||||
} else {
|
||||
$data = json_decode(substr($data, 1), true);
|
||||
}
|
||||
|
||||
if (!is_array($data) || !static::$securityProvider->verify($data)) {
|
||||
throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " .
|
||||
@@ -203,7 +217,20 @@ class SerializableClosure implements Serializable
|
||||
|
||||
$data = $data['closure'];
|
||||
} elseif ($data[0] === '@') {
|
||||
$data = json_decode(substr($data, 1), true);
|
||||
if ($data[1] !== '{') {
|
||||
$separator = strpos($data, '.');
|
||||
if ($separator === false) {
|
||||
throw new SecurityException('Invalid signed closure');
|
||||
}
|
||||
$hash = substr($data, 1, $separator - 1);
|
||||
$closure = substr($data, $separator + 1);
|
||||
|
||||
$data = ['hash' => $hash, 'closure' => $closure];
|
||||
|
||||
unset($hash, $closure);
|
||||
} else {
|
||||
$data = json_decode(substr($data, 1), true);
|
||||
}
|
||||
|
||||
if (!is_array($data) || !isset($data['closure']) || !isset($data['hash'])) {
|
||||
throw new SecurityException('Invalid signed closure');
|
||||
|
||||
Reference in New Issue
Block a user