1
0
mirror of synced 2025-01-10 11:07:10 +03:00

Merge pull request #1045 from marmotz/master

Fix the "Erroneous data format for unserializing" error message
This commit is contained in:
Guilherme Blanco 2014-05-30 09:11:34 -04:00
commit a851dd68fb

View File

@ -908,8 +908,13 @@ class ClassMetadataInfo implements ClassMetadata
public function newInstance() public function newInstance()
{ {
if ($this->_prototype === null) { if ($this->_prototype === null) {
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)); $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
} }
}
return clone $this->_prototype; return clone $this->_prototype;
} }