From 530c01b5e3ed7345cde564bd511794ac72f49b65 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 3 Jun 2014 17:36:31 +0200 Subject: [PATCH] [DDC-3120] Fix bug with unserialize bc break in PHP 5.4.29 and PHP 5.5.13 --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 01d5b77dd..73b555666 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -866,7 +866,11 @@ 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 (PHP_VERSION_ID === 50428 || PHP_VERSION_ID === 50513) { + $this->_prototype = $this->reflClass->newInstanceWithoutConstructor(); + } else { + $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name)); + } } return clone $this->_prototype;