Skip to content

Commit

Permalink
Merge pull request #499 from joschi127/master
Browse files Browse the repository at this point in the history
Fix for ClassMetadata::newInstance() PHP 5.5.13
  • Loading branch information
dbu committed Jun 3, 2014
2 parents fe5cc1b + 0d3706b commit 00e1590
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,12 @@ public function __sleep()
public function newInstance()
{
if ($this->prototype === null) {
$this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
if (PHP_VERSION_ID >= 50400) {
$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;
Expand Down

0 comments on commit 00e1590

Please sign in to comment.