updated core to 1.7.15
This commit is contained in:
47
system/src/Grav/Framework/Compat/Serializable.php
Normal file
47
system/src/Grav/Framework/Compat/Serializable.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Grav\Framework\Compat
|
||||
*
|
||||
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Compat;
|
||||
|
||||
/**
|
||||
* Serializable trait
|
||||
*
|
||||
* Adds backwards compatibility to PHP 7.3 Serializable interface.
|
||||
*
|
||||
* Note: Remember to add: `implements \Serializable` to the classes which use this trait.
|
||||
*
|
||||
* @package Grav\Framework\Traits
|
||||
*/
|
||||
trait Serializable
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
final public function serialize(): string
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $serialized
|
||||
* @return void
|
||||
*/
|
||||
final public function unserialize($serialized): void
|
||||
{
|
||||
$this->__unserialize(unserialize($serialized, ['allowed_classes' => $this->getUnserializeAllowedClasses()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|bool
|
||||
*/
|
||||
protected function getUnserializeAllowedClasses()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user