From 87a399090e1867054471cf2f295f10d7620885a4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 6 Sep 2015 07:36:52 +0200 Subject: php-php-gettext: php7 patch from Fedora --- php-php-gettext-1.0.11-php7.patch | 48 +++++++++++++++++++++++++++++++++++++++ php-php-gettext.spec | 26 +++++++++++++++++---- 2 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 php-php-gettext-1.0.11-php7.patch diff --git a/php-php-gettext-1.0.11-php7.patch b/php-php-gettext-1.0.11-php7.patch new file mode 100644 index 0000000..f3b9eed --- /dev/null +++ b/php-php-gettext-1.0.11-php7.patch @@ -0,0 +1,48 @@ +Patch by Marc Delisle for php-gettext >= 1.0.11, which adds +PHP 7 compatibility, see also http://php.net/manual/en/language.oop5.decon.php for +details: For backwards compatibility, if PHP 5 cannot find a __construct() function +for a given class, and the class did not inherit one from a parent class, it will +search for the old-style constructor function, by the name of the class. + +Without this patch, https://github.com/phpmyadmin/phpmyadmin/issues/11462 happens. + +--- php-gettext-1.0.11/gettext.php 2010-12-25 00:15:19.000000000 +0100 ++++ php-gettext-1.0.11/gettext.php.php7 2015-09-04 21:45:09.000000000 +0200 +@@ -98,7 +98,7 @@ + * @param object Reader the StreamReader object + * @param boolean enable_cache Enable or disable caching of strings (default on) + */ +- function gettext_reader($Reader, $enable_cache = true) { ++ public function __construct($Reader, $enable_cache = true) { + // If there isn't a StreamReader, turn on short circuit mode. + if (! $Reader || isset($Reader->error) ) { + $this->short_circuit = true; +--- php-gettext-1.0.11/streams.php 2010-02-15 12:05:57.000000000 +0100 ++++ php-gettext-1.0.11/streams.php.php7 2015-09-04 21:45:09.000000000 +0200 +@@ -49,7 +49,7 @@ + var $_pos; + var $_str; + +- function StringReader($str='') { ++ public function __construct($str='') { + $this->_str = $str; + $this->_pos = 0; + } +@@ -86,7 +86,7 @@ + var $_fd; + var $_length; + +- function FileReader($filename) { ++ public function __construct($filename) { + if (file_exists($filename)) { + + $this->_length=filesize($filename); +@@ -143,7 +143,7 @@ + // Preloads entire file in memory first, then creates a StringReader + // over it (it assumes knowledge of StringReader internals) + class CachedFileReader extends StringReader { +- function CachedFileReader($filename) { ++ public function __construct($filename) { + if (file_exists($filename)) { + + $length=filesize($filename); diff --git a/php-php-gettext.spec b/php-php-gettext.spec index 6c10085..dd37a49 100644 --- a/php-php-gettext.spec +++ b/php-php-gettext.spec @@ -1,13 +1,25 @@ +# remirepo spec file for php-php-gettext, from: +# +# Fedora spec file for php-php-gettext +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + Summary: Gettext emulation in PHP Name: php-php-gettext Version: 1.0.11 -Release: 4%{?dist} +Release: 12%{?dist} License: GPLv2+ Group: Development/Libraries URL: https://launchpad.net/php-gettext Source0: http://launchpad.net/php-gettext/trunk/%{version}/+download/php-gettext-%{version}.tar.gz -Requires: php-common, php-mbstring -Obsoletes: php-gettext < 1.0.11-3 +Patch0: php-php-gettext-1.0.11-php7.patch +Requires: php-common +Requires: php-mbstring +Obsoletes: php-gettext < 1.0.11-5 Obsoletes: php53-php-gettext BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -18,6 +30,7 @@ not compiled in or when appropriate locale is not present on the system. %prep %setup -q -n php-gettext-%{version} +%patch0 -p1 -b .php7 %build @@ -32,10 +45,15 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%doc README AUTHORS COPYING +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc README AUTHORS %{_datadir}/php/gettext/ %changelog +* Fri Sep 04 2015 Robert Scheck 1.0.11-12 +- Added a patch for compatibility with PHP 7 + * Mon Sep 3 2012 Remi Collet 1.0.11-4 - obsoletes php53-php-gettext -- cgit