From 30291eb868f96062e5aef07bf96af151865ac947 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sat, 28 Mar 2015 21:40:48 +0100 Subject: [PATCH 1/5] Fix invalid octal literals --- tests/Zend/DateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Zend/DateTest.php b/tests/Zend/DateTest.php index 2b2e057eeb..03b9dd19a2 100644 --- a/tests/Zend/DateTest.php +++ b/tests/Zend/DateTest.php @@ -5522,7 +5522,7 @@ public function testUsePhpNFormat() Zend_Date::setOptions(array('format_type' => 'php')); date_default_timezone_set('GMT'); - $date = new Zend_Date(mktime(20,10,0,09,20,2009)); + $date = new Zend_Date(mktime(20,10,0,9,20,2009)); $this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString( 'w')); $this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString( 'd')); $this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('D', 'en')); @@ -5561,7 +5561,7 @@ public function testUsePhpNFormat() $this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString( 'U')); date_default_timezone_set('Indian/Maldives'); - $date = new Zend_Date(mktime(20,10,0,09,20,2009)); + $date = new Zend_Date(mktime(20,10,0,9,20,2009)); $this->assertSame(date('w',$date->getTimestamp()), $date->toString( 'w')); $this->assertSame(date('d',$date->getTimestamp()), $date->toString( 'd')); $this->assertSame(date('D',$date->getTimestamp()), $date->toString('D', 'en')); From cd3ad20d655c1823b645393f0a659d38f17535a8 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sat, 28 Mar 2015 22:16:22 +0100 Subject: [PATCH 2/5] PHP typehinting can't be tested as it throws fatal error in PHP 7 --- tests/Zend/Log/Writer/AbstractTest.php | 7 +++++++ tests/Zend/Log/Writer/DbTest.php | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/tests/Zend/Log/Writer/AbstractTest.php b/tests/Zend/Log/Writer/AbstractTest.php index bbb6d01fe0..45b0e517c0 100644 --- a/tests/Zend/Log/Writer/AbstractTest.php +++ b/tests/Zend/Log/Writer/AbstractTest.php @@ -37,6 +37,9 @@ */ class Zend_Log_Writer_AbstractTest extends PHPUnit_Framework_TestCase { + /** + * @var Zend_Log_Writer_Abstract + */ protected $_writer; public static function main() @@ -55,6 +58,10 @@ protected function setUp() */ public function testSetFormatter() { + if (version_compare(phpversion(), '7', '>=')) { + $this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+'); + } + require_once 'Zend/Log/Formatter/Simple.php'; $this->_writer->setFormatter(new Zend_Log_Formatter_Simple()); $this->setExpectedException('PHPUnit_Framework_Error'); diff --git a/tests/Zend/Log/Writer/DbTest.php b/tests/Zend/Log/Writer/DbTest.php index e22783d4eb..548d2005c9 100644 --- a/tests/Zend/Log/Writer/DbTest.php +++ b/tests/Zend/Log/Writer/DbTest.php @@ -138,6 +138,10 @@ public function testFactory() */ public function testThrowStrictSetFormatter() { + if (version_compare(phpversion(), '7', '>=')) { + $this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+'); + } + try { $this->writer->setFormatter(new StdClass()); } catch (Exception $e) { From ec3df7ab1ad9c0c5d25a806786af06d990e661a7 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sat, 28 Mar 2015 22:42:50 +0100 Subject: [PATCH 3/5] Skip Zend_Serializer_Adapter_PhpCode test of unserializing invalid input in PHP7+ --- tests/Zend/Serializer/Adapter/PhpCodeTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Zend/Serializer/Adapter/PhpCodeTest.php b/tests/Zend/Serializer/Adapter/PhpCodeTest.php index a2ebcd4e31..aa7387880e 100644 --- a/tests/Zend/Serializer/Adapter/PhpCodeTest.php +++ b/tests/Zend/Serializer/Adapter/PhpCodeTest.php @@ -141,6 +141,9 @@ public function testUnserializeObject() public function testUnserialzeInvalid() { + if (version_compare(phpversion(), '7', '>=')) { + $this->markTestSkipped('Evaling of invalid input is PHP Parse error in PHP7+'); + } $value = 'not a serialized string'; $this->setExpectedException('Zend_Serializer_Exception'); $this->_adapter->unserialize($value); From d8c2145b1e50cb120899157fab4c2a7239961849 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sat, 28 Mar 2015 22:43:39 +0100 Subject: [PATCH 4/5] Bye bye PHP6 --- library/Zend/Serializer/Adapter/PythonPickle.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/library/Zend/Serializer/Adapter/PythonPickle.php b/library/Zend/Serializer/Adapter/PythonPickle.php index 468c02db56..aae13729f6 100644 --- a/library/Zend/Serializer/Adapter/PythonPickle.php +++ b/library/Zend/Serializer/Adapter/PythonPickle.php @@ -99,11 +99,6 @@ class Zend_Serializer_Adapter_PythonPickle extends Zend_Serializer_Adapter_Adapt const OP_BINBYTES = 'B'; // push bytes; counted binary string argument const OP_SHORT_BINBYTES = 'C'; // " " ; " " " " < 256 bytes - /** - * @var bool Whether or not this is a PHP 6 binary - */ - protected static $_isPhp6 = null; - /** * @var bool Whether or not the system is little-endian */ @@ -155,9 +150,6 @@ public function __construct($opts=array()) if (self::$_isLittleEndian === null) { self::$_isLittleEndian = (pack('l', 1) === "\x01\x00\x00\x00"); } - if (self::$_isPhp6 === null) { - self::$_isPhp6 = !version_compare(PHP_VERSION, '6.0.0', '<'); - } $this->_marker = new stdClass(); } @@ -1103,10 +1095,6 @@ protected function _loadUnicode() $pattern = '/\\\\u([a-fA-F0-9]{4})/u'; // \uXXXX $data = preg_replace_callback($pattern, array($this, '_convertMatchingUnicodeSequence2Utf8'), $data); - if (self::$_isPhp6) { - $data = unicode_decode($data, 'UTF-8'); - } - $this->_stack[] = $data; } @@ -1172,10 +1160,6 @@ protected function _loadBinUnicode() list(, $n) = unpack('l', $n); $data = $this->_read($n); - if (self::$_isPhp6) { - $data = unicode_decode($data, 'UTF-8'); - } - $this->_stack[] = $data; } From 73480b298da9af6d221dadf66eef9f49c4908af3 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sat, 28 Mar 2015 22:48:04 +0100 Subject: [PATCH 5/5] Skip Zend_Service_DeveloperGarden_OfflineSecurityTokenServer typehinting tests --- .../DeveloperGarden/OfflineSecurityTokenServerTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Zend/Service/DeveloperGarden/OfflineSecurityTokenServerTest.php b/tests/Zend/Service/DeveloperGarden/OfflineSecurityTokenServerTest.php index 2d153a153b..d8648d3dbf 100644 --- a/tests/Zend/Service/DeveloperGarden/OfflineSecurityTokenServerTest.php +++ b/tests/Zend/Service/DeveloperGarden/OfflineSecurityTokenServerTest.php @@ -164,6 +164,10 @@ public function testGetTokenFromCache() public function testSetTokenToCache1stParamException() { + if (version_compare(phpversion(), '7', '>=')) { + $this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+'); + } + try { Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache( 'NotExisting', @@ -176,6 +180,10 @@ public function testSetTokenToCache1stParamException() public function testSetTokenToCache2ndParamException() { + if (version_compare(phpversion(), '7', '>=')) { + $this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+'); + } + try { Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache( 'securityToken',