From 74e8a3ce5005b228d391ddd32150131e70fc18e2 Mon Sep 17 00:00:00 2001 From: Alexander Wozniak <wozniak@oktopos.com> Date: Mon, 30 Nov 2020 11:54:13 +0100 Subject: [PATCH] Missing default values caused errorHandlerIgnore to fail under PHP8 The changed tests all change their errorhandlers in some tests. As the last param ($errContext) had no default value assigned the tests would error out. --- tests/Zend/FilterTest.php | 2 +- tests/Zend/Form/Element/FileTest.php | 2 +- tests/Zend/LocaleTest.php | 2 +- tests/Zend/Translate/Adapter/ArrayTest.php | 2 +- tests/Zend/Translate/Adapter/CsvTest.php | 2 +- tests/Zend/Translate/Adapter/GettextTest.php | 2 +- tests/Zend/Translate/Adapter/IniTest.php | 2 +- tests/Zend/Translate/Adapter/QtTest.php | 2 +- tests/Zend/Translate/Adapter/TbxTest.php | 2 +- tests/Zend/Translate/Adapter/TmxTest.php | 2 +- tests/Zend/Translate/Adapter/XliffTest.php | 2 +- tests/Zend/Translate/Adapter/XmlTmTest.php | 2 +- tests/Zend/TranslateTest.php | 2 +- tests/Zend/Validate/AbstractTest.php | 2 +- tests/Zend/Validate/CcnumTest.php | 2 +- tests/Zend/Validate/DateTest.php | 8 ++++++-- tests/Zend/ValidateTest.php | 2 +- tests/Zend/View/Helper/Navigation/NavigationTest.php | 2 +- 18 files changed, 23 insertions(+), 19 deletions(-) diff --git a/tests/Zend/FilterTest.php b/tests/Zend/FilterTest.php index b46313ac6..5b5efa339 100644 --- a/tests/Zend/FilterTest.php +++ b/tests/Zend/FilterTest.php @@ -213,7 +213,7 @@ public function testUsageOfOldStaticFactory() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Form/Element/FileTest.php b/tests/Zend/Form/Element/FileTest.php index fca5a0d98..4bfc26741 100644 --- a/tests/Zend/Form/Element/FileTest.php +++ b/tests/Zend/Form/Element/FileTest.php @@ -484,7 +484,7 @@ private function _convertIniToInteger($setting) * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/LocaleTest.php b/tests/Zend/LocaleTest.php index 1510a6a6d..c4536e275 100644 --- a/tests/Zend/LocaleTest.php +++ b/tests/Zend/LocaleTest.php @@ -969,7 +969,7 @@ public function testEachDataFileShouldPresentAsLocaleData() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/ArrayTest.php b/tests/Zend/Translate/Adapter/ArrayTest.php index 9cddc58a0..10ec49a47 100644 --- a/tests/Zend/Translate/Adapter/ArrayTest.php +++ b/tests/Zend/Translate/Adapter/ArrayTest.php @@ -341,7 +341,7 @@ public function testLoadingFilesIntoCacheAfterwards() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/CsvTest.php b/tests/Zend/Translate/Adapter/CsvTest.php index 20272273f..58ab569fa 100644 --- a/tests/Zend/Translate/Adapter/CsvTest.php +++ b/tests/Zend/Translate/Adapter/CsvTest.php @@ -235,7 +235,7 @@ public function testSpecialChars() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/GettextTest.php b/tests/Zend/Translate/Adapter/GettextTest.php index 424bddfcc..3e98cf83d 100644 --- a/tests/Zend/Translate/Adapter/GettextTest.php +++ b/tests/Zend/Translate/Adapter/GettextTest.php @@ -310,7 +310,7 @@ public function testPluralToSingular() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/IniTest.php b/tests/Zend/Translate/Adapter/IniTest.php index 232de0f23..c72f9cd21 100644 --- a/tests/Zend/Translate/Adapter/IniTest.php +++ b/tests/Zend/Translate/Adapter/IniTest.php @@ -206,7 +206,7 @@ public function testOptionLocaleFilename() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/QtTest.php b/tests/Zend/Translate/Adapter/QtTest.php index 29e0b4ebf..f55a02b9e 100644 --- a/tests/Zend/Translate/Adapter/QtTest.php +++ b/tests/Zend/Translate/Adapter/QtTest.php @@ -240,7 +240,7 @@ public function testIsoEncoding() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/TbxTest.php b/tests/Zend/Translate/Adapter/TbxTest.php index 6f103d98f..031ca96c6 100644 --- a/tests/Zend/Translate/Adapter/TbxTest.php +++ b/tests/Zend/Translate/Adapter/TbxTest.php @@ -244,7 +244,7 @@ public function testWithoutEncoding() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/TmxTest.php b/tests/Zend/Translate/Adapter/TmxTest.php index e2c5202c5..5a8fed681 100644 --- a/tests/Zend/Translate/Adapter/TmxTest.php +++ b/tests/Zend/Translate/Adapter/TmxTest.php @@ -270,7 +270,7 @@ public function testUseId() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/XliffTest.php b/tests/Zend/Translate/Adapter/XliffTest.php index 70c550c47..4f8a9d64f 100644 --- a/tests/Zend/Translate/Adapter/XliffTest.php +++ b/tests/Zend/Translate/Adapter/XliffTest.php @@ -238,7 +238,7 @@ public function testIsoEncoding() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Translate/Adapter/XmlTmTest.php b/tests/Zend/Translate/Adapter/XmlTmTest.php index 986226101..514ca0095 100644 --- a/tests/Zend/Translate/Adapter/XmlTmTest.php +++ b/tests/Zend/Translate/Adapter/XmlTmTest.php @@ -246,7 +246,7 @@ public function testWithoutEncoding() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext= array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/TranslateTest.php b/tests/Zend/TranslateTest.php index 21b2ba89a..8304342b7 100644 --- a/tests/Zend/TranslateTest.php +++ b/tests/Zend/TranslateTest.php @@ -905,7 +905,7 @@ public function testSettingLogPriorityForLog() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccured = true; } diff --git a/tests/Zend/Validate/AbstractTest.php b/tests/Zend/Validate/AbstractTest.php index 26c28bdc8..32157ec37 100644 --- a/tests/Zend/Validate/AbstractTest.php +++ b/tests/Zend/Validate/AbstractTest.php @@ -286,7 +286,7 @@ public function testMaximumErrorMessageLength() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/Validate/CcnumTest.php b/tests/Zend/Validate/CcnumTest.php index 6f4abf333..55546bdb8 100644 --- a/tests/Zend/Validate/CcnumTest.php +++ b/tests/Zend/Validate/CcnumTest.php @@ -95,7 +95,7 @@ public function testGetMessages() * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccured = true; } diff --git a/tests/Zend/Validate/DateTest.php b/tests/Zend/Validate/DateTest.php index a0305e84d..c623169f0 100644 --- a/tests/Zend/Validate/DateTest.php +++ b/tests/Zend/Validate/DateTest.php @@ -208,7 +208,11 @@ public function testLocaleContructor() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + try { + $this->assertFalse($this->_validator->isValid(array(1 => 1))); + } catch (Error $e) { + $this->assertTrue($e instanceof TypeError); + } } /** @@ -251,7 +255,7 @@ public function testArrayVerification() * @return void * @group ZF-2789 */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/ValidateTest.php b/tests/Zend/ValidateTest.php index b7b4d1b14..0fef2733c 100644 --- a/tests/Zend/ValidateTest.php +++ b/tests/Zend/ValidateTest.php @@ -242,7 +242,7 @@ public function handleNotFoundError($errnum, $errstr) * @param array $errcontext * @return void */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext) + public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext = array()) { $this->_errorOccurred = true; } diff --git a/tests/Zend/View/Helper/Navigation/NavigationTest.php b/tests/Zend/View/Helper/Navigation/NavigationTest.php index 2f5deb01d..0228d0d1c 100644 --- a/tests/Zend/View/Helper/Navigation/NavigationTest.php +++ b/tests/Zend/View/Helper/Navigation/NavigationTest.php @@ -334,7 +334,7 @@ public function testSetDefaultRoleThrowsExceptionWhenGivenAnArbitraryObject() } private $_errorMessage; - public function toStringErrorHandler($code, $msg, $file, $line, array $c) + public function toStringErrorHandler($code, $msg, $file, $line, array $c = array()) { $this->_errorMessage = $msg; }