1
0
mirror of synced 2025-01-09 02:27:10 +03:00

Fix the "Erroneous data format for unserializing" error message

This commit is contained in:
Renaud LITTOLFF 2014-05-30 10:43:11 +02:00
parent 5d1275e938
commit 93c276d059

View File

@ -908,7 +908,12 @@ class ClassMetadataInfo implements ClassMetadata
public function newInstance()
{
if ($this->_prototype === null) {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
if (version_compare(PHP_VERSION, '5.4') >= 0) {
$rc = new \ReflectionClass($this->name);
$this->_prototype = $rc->newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
}
}
return clone $this->_prototype;