[php-doctrine-orm] upstream fix for latest PHP (#1103219)

Remi Collet remi at fedoraproject.org
Fri May 30 15:21:26 UTC 2014


commit bd8e1f31db0de633a686cd402ff72a3e8b341e29
Author: Remi Collet <rcollet at redhat.com>
Date:   Fri May 30 17:21:24 2014 +0200

    upstream fix for latest PHP (#1103219)

 php-doctrine-orm-upstream.patch |   31 +++++++++++++++++++++++++++++++
 php-doctrine-orm.spec           |   14 +++++++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/php-doctrine-orm-upstream.patch b/php-doctrine-orm-upstream.patch
new file mode 100644
index 0000000..4754af4
--- /dev/null
+++ b/php-doctrine-orm-upstream.patch
@@ -0,0 +1,31 @@
+From 93c276d059b40b0783ba9a24549a8b135e257693 Mon Sep 17 00:00:00 2001
+From: Renaud LITTOLFF <renaud at atipik.fr>
+Date: Fri, 30 May 2014 10:43:11 +0200
+Subject: [PATCH] Fix the "Erroneous data format for unserializing" error
+ message
+
+---
+ lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+index ba7a2d2..5fe8587 100644
+--- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
++++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+@@ -908,7 +908,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 (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;
+-- 
+1.9.3
+
diff --git a/php-doctrine-orm.spec b/php-doctrine-orm.spec
index 40f6dcc..0e1f6e8 100644
--- a/php-doctrine-orm.spec
+++ b/php-doctrine-orm.spec
@@ -18,7 +18,7 @@
 
 Name:      php-%{github_owner}-orm
 Version:   %{github_version}
-Release:   1%{?dist}
+Release:   2%{?dist}
 Summary:   Doctrine Object-Relational-Mapper (ORM)
 
 Group:     Development/Libraries
@@ -30,6 +30,9 @@ Source0:   https://github.com/%{github_owner}/%{github_name}/archive/%{github_co
 # 2) Auto-load using Doctrine\Common\ClassLoader
 Patch0:    %{name}-bin.patch
 
+# Upstream fix for latest PHP
+Patch1:    %{name}-upstream.patch
+
 BuildArch: noarch
 
 Requires:  php(language)            >= %{php_min_ver}
@@ -78,9 +81,15 @@ Optional caches (see Doctrine\ORM\Tools\Setup::createConfiguration()):
 # Patch bin script
 %patch0 -p1
 
+# For PHP 5.5.13+
+%patch1 -p1
+
 # Remove empty file
 rm -f lib/Doctrine/ORM/README.markdown
 
+# Clenup backup files
+find . -name \*.orig -exec rm {} \;
+
 # Remove unnecessary executable bit
 chmod a-x lib/Doctrine/ORM/Tools/Pagination/Paginator.php
 
@@ -108,6 +117,9 @@ install -pm 0755 bin/doctrine.php %{buildroot}/%{_bindir}/doctrine
 
 
 %changelog
+* Fri May 30 2014 Remi Collet <remi at fedoraproject.org> 2.4.2-2
+- upstream fix for latest PHP (#1103219)
+
 * Wed Feb 12 2014 Shawn Iwinski <shawn.iwinski at gmail.com> 2.4.2-1
 - Updated to 2.4.2 (BZ #1063021)
 


More information about the scm-commits mailing list