mirror of
https://github.com/getgrav/grav.git
synced 2026-07-08 09:51:26 +02:00
Fixed unserialize Framework\File classes
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
1. [](#bugfix)
|
||||
* Fixed port issue with `system.custom_base_url`
|
||||
* Hide errors with `exif_read_data` in `ImageFile`
|
||||
* Fixed unserialize in `MarkdownFormatter` class
|
||||
* Fixed unserialize in `MarkdownFormatter` and `Framework\File` classes
|
||||
|
||||
# v1.7.0-rc.20
|
||||
## 12/15/2020
|
||||
|
||||
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Grav\Framework\File;
|
||||
|
||||
use Grav\Framework\Compat\Serializable;
|
||||
use Grav\Framework\File\Interfaces\FileInterface;
|
||||
use Grav\Framework\Filesystem\Filesystem;
|
||||
|
||||
@@ -20,6 +21,8 @@ use Grav\Framework\Filesystem\Filesystem;
|
||||
*/
|
||||
class AbstractFile implements FileInterface
|
||||
{
|
||||
use Serializable;
|
||||
|
||||
/** @var Filesystem */
|
||||
private $filesystem;
|
||||
/** @var string */
|
||||
@@ -67,20 +70,22 @@ class AbstractFile implements FileInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function serialize(): string
|
||||
final public function __serialize(): array
|
||||
{
|
||||
return serialize($this->doSerialize());
|
||||
return ['filesystem_normalize' => $this->filesystem->getNormalization()] + $this->doSerialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $serialized
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function unserialize($serialized): void
|
||||
final public function __unserialize(array $data): void
|
||||
{
|
||||
$this->doUnserialize(unserialize($serialized, ['allowed_classes' => false]));
|
||||
$this->filesystem = Filesystem::getInstance($data['filesystem_normalize'] ?? null);
|
||||
|
||||
$this->doUnserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,6 +78,14 @@ class Filesystem implements FilesystemInterface
|
||||
return static::getInstance($normalize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getNormalization(): ?bool
|
||||
{
|
||||
return $this->normalize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force all paths to be normalized.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user