Conditionally add options to unserialize in PHP 7.0+.
This commit is contained in:
parent
51bc35cc84
commit
b4201810b9
@ -93,7 +93,11 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
public function getProfile()
|
||||
{
|
||||
if (null === $this->profile) {
|
||||
$this->profile = unserialize($this->data['profile']);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
$this->profile = unserialize($this->data['profile'], array('allowed_classes' => array('Twig_Profiler_Profile')));
|
||||
} else {
|
||||
$this->profile = unserialize($this->data['profile']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->profile;
|
||||
|
@ -60,7 +60,11 @@ class AutowireServiceResource implements SelfCheckingResourceInterface, \Seriali
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,6 +185,10 @@ class FormError implements \Serializable
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
list($this->message, $this->messageTemplate, $this->messageParameters, $this->messagePluralization, $this->cause) = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
list($this->message, $this->messageTemplate, $this->messageParameters, $this->messagePluralization, $this->cause) = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
list($this->message, $this->messageTemplate, $this->messageParameters, $this->messagePluralization, $this->cause) = unserialize($serialized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,11 @@ class EnvParametersResource implements SelfCheckingResourceInterface, \Serializa
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$unserialized = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
$unserialized = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
$unserialized = unserialize($serialized);
|
||||
}
|
||||
|
||||
$this->prefix = $unserialized['prefix'];
|
||||
$this->variables = $unserialized['variables'];
|
||||
|
@ -63,7 +63,11 @@ class FileLinkFormatter implements \Serializable
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->fileLinkFormat = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
$this->fileLinkFormat = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
$this->fileLinkFormat = unserialize($serialized);
|
||||
}
|
||||
}
|
||||
|
||||
private function getFileLinkFormat()
|
||||
|
@ -734,7 +734,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($environment, $debug) = unserialize($data);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
list($environment, $debug) = unserialize($data, array('allowed_classes' => false));
|
||||
} else {
|
||||
list($environment, $debug) = unserialize($data);
|
||||
}
|
||||
|
||||
$this->__construct($environment, $debug);
|
||||
}
|
||||
|
@ -73,7 +73,12 @@ class CompiledRoute implements \Serializable
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$data = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
$data = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
$data = unserialize($serialized);
|
||||
}
|
||||
|
||||
$this->variables = $data['vars'];
|
||||
$this->staticPrefix = $data['path_prefix'];
|
||||
$this->regex = $data['path_regex'];
|
||||
|
@ -116,7 +116,11 @@ class Route implements \Serializable
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$data = unserialize($serialized);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
$data = unserialize($serialized, array('allowed_classes' => array(CompiledRoute::class)));
|
||||
} else {
|
||||
$data = unserialize($serialized);
|
||||
}
|
||||
$this->path = $data['path'];
|
||||
$this->host = $data['host'];
|
||||
$this->defaults = $data['defaults'];
|
||||
|
Reference in New Issue
Block a user