summaryrefslogtreecommitdiffstats
path: root/php-php-gettext-1.0.11-php7.patch
blob: f3b9eed56d5ef98687f1e202f938d55272340f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Patch by Marc Delisle <marc@infomarc.info> 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);