From fa24ff37e8d5ab80f0e9a32fe92274a74062228e Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Tue, 1 Mar 2016 15:47:12 -0800 Subject: [PATCH] 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. Bump the minimum version of PHP to 5.0.0 where __construct support was added. Signed-off-by: Nishanth Aravamudan --- Cache/Lite.php | 2 +- Cache/Lite/File.php | 4 ++-- Cache/Lite/Function.php | 4 ++-- Cache/Lite/Output.php | 4 ++-- package.xml | 2 +- tests/Cache_Lite_Function_classical.phpt | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cache/Lite.php b/Cache/Lite.php index 0ca762d..5770f3d 100644 --- a/Cache/Lite.php +++ b/Cache/Lite.php @@ -294,7 +294,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/File.php b/Cache/Lite/File.php index 2cb2758..d8ca31c 100644 --- a/Cache/Lite/File.php +++ b/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/Function.php b/Cache/Lite/Function.php index 6c4861a..0814b58 100644 --- a/Cache/Lite/Function.php +++ b/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 @@ function Cache_Lite_Function($options = array(NULL)) } } reset($options); - $this->Cache_Lite($options); + parent::__construct($options); } /** diff --git a/Cache/Lite/Output.php b/Cache/Lite/Output.php index 87d7c19..9880cfa 100644 --- a/Cache/Lite/Output.php +++ b/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/package.xml b/package.xml index 8aaea5d..637c909 100644 --- a/package.xml +++ b/package.xml @@ -87,7 +87,7 @@ - 4.0.0 + 5.0.0 1.5.4 diff --git a/tests/Cache_Lite_Function_classical.phpt b/tests/Cache_Lite_Function_classical.phpt index 3fbf9a7..1358f57 100644 --- a/tests/Cache_Lite_Function_classical.phpt +++ b/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'));