File: 0002-PHP7-has-deprecated-same-named-functions-as-construc.patch

package info (click to toggle)
php-cache-lite 1.7.16-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 424 kB
  • ctags: 458
  • sloc: php: 872; xml: 819; pascal: 28; makefile: 12
file content (100 lines) | stat: -rw-r--r-- 4,205 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
From: Nishanth Aravamudan <nish.aravamudan@canonical.com>
Date: Tue, 1 Mar 2016 15:47:12 -0800
Subject: PHP7 has deprecated same-named functions as constructors

As per, http://php.net/manual/en/language.oop5.decon.php, "Old style
constructors are DEPRECATED in PHP 7.0, and will be removed in a future
version. You should always use __construct() in new code." The current
tests fail on PHP7.0 based installs due to the deprecation warnings.

Signed-off-by: Nishanth Aravamudan <nish.aravamudan@canonical.com>
Origin: vendor, https://github.com/pear/Cache_Lite/pull/5/commits/fb84959eaab2448489eb236e69eec2bbf4f36f47
---
 Cache_Lite-1.7.16/Cache/Lite.php                           | 2 +-
 Cache_Lite-1.7.16/Cache/Lite/File.php                      | 4 ++--
 Cache_Lite-1.7.16/Cache/Lite/Function.php                  | 4 ++--
 Cache_Lite-1.7.16/Cache/Lite/Output.php                    | 4 ++--
 Cache_Lite-1.7.16/tests/Cache_Lite_Function_classical.phpt | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Cache_Lite-1.7.16/Cache/Lite.php b/Cache_Lite-1.7.16/Cache/Lite.php
index 3ec1b88..ccb076d 100644
--- a/Cache_Lite-1.7.16/Cache/Lite.php
+++ b/Cache_Lite-1.7.16/Cache/Lite.php
@@ -295,7 +295,7 @@ class Cache_Lite
     * @param array $options options
     * @access public
     */
-    function Cache_Lite($options = array(NULL))
+    function __construct($options = array(NULL))
     {
         foreach($options as $key => $value) {
             $this->setOption($key, $value);
diff --git a/Cache_Lite-1.7.16/Cache/Lite/File.php b/Cache_Lite-1.7.16/Cache/Lite/File.php
index 2cb2758..d8ca31c 100644
--- a/Cache_Lite-1.7.16/Cache/Lite/File.php
+++ b/Cache_Lite-1.7.16/Cache/Lite/File.php
@@ -52,10 +52,10 @@ class Cache_Lite_File extends Cache_Lite
     * @param array $options options
     * @access public
     */
-    function Cache_Lite_File($options = array(NULL))
+    function __construct($options = array(NULL))
     {   
         $options['lifetime'] = 0;
-        $this->Cache_Lite($options);
+        parent::__construct($options);
         if (isset($options['masterFile'])) {
             $this->_masterFile = $options['masterFile'];
         } else {
diff --git a/Cache_Lite-1.7.16/Cache/Lite/Function.php b/Cache_Lite-1.7.16/Cache/Lite/Function.php
index 6c4861a..0814b58 100644
--- a/Cache_Lite-1.7.16/Cache/Lite/Function.php
+++ b/Cache_Lite-1.7.16/Cache/Lite/Function.php
@@ -81,7 +81,7 @@ class Cache_Lite_Function extends Cache_Lite
     * @param array $options options
     * @access public
     */
-    function Cache_Lite_Function($options = array(NULL))
+    function __construct($options = array(NULL))
     {
         $availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
         while (list($name, $value) = each($options)) {
@@ -91,7 +91,7 @@ class Cache_Lite_Function extends Cache_Lite
             }
         }
         reset($options);
-        $this->Cache_Lite($options);
+        parent::__construct($options);
     }
 
     /**
diff --git a/Cache_Lite-1.7.16/Cache/Lite/Output.php b/Cache_Lite-1.7.16/Cache/Lite/Output.php
index 87d7c19..9880cfa 100644
--- a/Cache_Lite-1.7.16/Cache/Lite/Output.php
+++ b/Cache_Lite-1.7.16/Cache/Lite/Output.php
@@ -26,9 +26,9 @@ class Cache_Lite_Output extends Cache_Lite
     * @param array $options options
     * @access public
     */
-    function Cache_Lite_Output($options)
+    function __construct($options)
     {
-        $this->Cache_Lite($options);
+        parent::__construct($options);
     }
 
     /**
diff --git a/Cache_Lite-1.7.16/tests/Cache_Lite_Function_classical.phpt b/Cache_Lite-1.7.16/tests/Cache_Lite_Function_classical.phpt
index 3fbf9a7..1358f57 100644
--- a/Cache_Lite-1.7.16/tests/Cache_Lite_Function_classical.phpt
+++ b/Cache_Lite-1.7.16/tests/Cache_Lite_Function_classical.phpt
@@ -64,7 +64,7 @@ class bench
 
 class test
 {
-    function test($options) {
+    function __construct($options) {
         $this->foo = 'bar';
         $cache = new Cache_Lite_Function($options);
         echo($cache->call(array($this, 'method_to_bench'), 'foo', 'bar'));