Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 0cef832

Browse files
committed
Merge pull request zendframework#541 from mhujer/php7-fixes
Fixed errors in tests on PHP7
2 parents 276db36 + 73480b2 commit 0cef832

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

library/Zend/Serializer/Adapter/PythonPickle.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ class Zend_Serializer_Adapter_PythonPickle extends Zend_Serializer_Adapter_Adapt
9999
const OP_BINBYTES = 'B'; // push bytes; counted binary string argument
100100
const OP_SHORT_BINBYTES = 'C'; // " " ; " " " " < 256 bytes
101101

102-
/**
103-
* @var bool Whether or not this is a PHP 6 binary
104-
*/
105-
protected static $_isPhp6 = null;
106-
107102
/**
108103
* @var bool Whether or not the system is little-endian
109104
*/
@@ -155,9 +150,6 @@ public function __construct($opts=array())
155150
if (self::$_isLittleEndian === null) {
156151
self::$_isLittleEndian = (pack('l', 1) === "\x01\x00\x00\x00");
157152
}
158-
if (self::$_isPhp6 === null) {
159-
self::$_isPhp6 = !version_compare(PHP_VERSION, '6.0.0', '<');
160-
}
161153

162154
$this->_marker = new stdClass();
163155
}
@@ -1103,10 +1095,6 @@ protected function _loadUnicode()
11031095
$pattern = '/\\\\u([a-fA-F0-9]{4})/u'; // \uXXXX
11041096
$data = preg_replace_callback($pattern, array($this, '_convertMatchingUnicodeSequence2Utf8'), $data);
11051097

1106-
if (self::$_isPhp6) {
1107-
$data = unicode_decode($data, 'UTF-8');
1108-
}
1109-
11101098
$this->_stack[] = $data;
11111099
}
11121100

@@ -1172,10 +1160,6 @@ protected function _loadBinUnicode()
11721160
list(, $n) = unpack('l', $n);
11731161
$data = $this->_read($n);
11741162

1175-
if (self::$_isPhp6) {
1176-
$data = unicode_decode($data, 'UTF-8');
1177-
}
1178-
11791163
$this->_stack[] = $data;
11801164
}
11811165

tests/Zend/DateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5522,7 +5522,7 @@ public function testUsePhpNFormat()
55225522
Zend_Date::setOptions(array('format_type' => 'php'));
55235523

55245524
date_default_timezone_set('GMT');
5525-
$date = new Zend_Date(mktime(20,10,0,09,20,2009));
5525+
$date = new Zend_Date(mktime(20,10,0,9,20,2009));
55265526
$this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString( 'w'));
55275527
$this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString( 'd'));
55285528
$this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('D', 'en'));
@@ -5561,7 +5561,7 @@ public function testUsePhpNFormat()
55615561
$this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString( 'U'));
55625562

55635563
date_default_timezone_set('Indian/Maldives');
5564-
$date = new Zend_Date(mktime(20,10,0,09,20,2009));
5564+
$date = new Zend_Date(mktime(20,10,0,9,20,2009));
55655565
$this->assertSame(date('w',$date->getTimestamp()), $date->toString( 'w'));
55665566
$this->assertSame(date('d',$date->getTimestamp()), $date->toString( 'd'));
55675567
$this->assertSame(date('D',$date->getTimestamp()), $date->toString('D', 'en'));

tests/Zend/Log/Writer/AbstractTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
*/
3838
class Zend_Log_Writer_AbstractTest extends PHPUnit_Framework_TestCase
3939
{
40+
/**
41+
* @var Zend_Log_Writer_Abstract
42+
*/
4043
protected $_writer;
4144

4245
public static function main()
@@ -55,6 +58,10 @@ protected function setUp()
5558
*/
5659
public function testSetFormatter()
5760
{
61+
if (version_compare(phpversion(), '7', '>=')) {
62+
$this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+');
63+
}
64+
5865
require_once 'Zend/Log/Formatter/Simple.php';
5966
$this->_writer->setFormatter(new Zend_Log_Formatter_Simple());
6067
$this->setExpectedException('PHPUnit_Framework_Error');

tests/Zend/Log/Writer/DbTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ public function testFactory()
138138
*/
139139
public function testThrowStrictSetFormatter()
140140
{
141+
if (version_compare(phpversion(), '7', '>=')) {
142+
$this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+');
143+
}
144+
141145
try {
142146
$this->writer->setFormatter(new StdClass());
143147
} catch (Exception $e) {

tests/Zend/Serializer/Adapter/PhpCodeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public function testUnserializeObject()
141141

142142
public function testUnserialzeInvalid()
143143
{
144+
if (version_compare(phpversion(), '7', '>=')) {
145+
$this->markTestSkipped('Evaling of invalid input is PHP Parse error in PHP7+');
146+
}
144147
$value = 'not a serialized string';
145148
$this->setExpectedException('Zend_Serializer_Exception');
146149
$this->_adapter->unserialize($value);

tests/Zend/Service/DeveloperGarden/OfflineSecurityTokenServerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ public function testGetTokenFromCache()
164164

165165
public function testSetTokenToCache1stParamException()
166166
{
167+
if (version_compare(phpversion(), '7', '>=')) {
168+
$this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+');
169+
}
170+
167171
try {
168172
Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache(
169173
'NotExisting',
@@ -176,6 +180,10 @@ public function testSetTokenToCache1stParamException()
176180

177181
public function testSetTokenToCache2ndParamException()
178182
{
183+
if (version_compare(phpversion(), '7', '>=')) {
184+
$this->markTestSkipped('Invalid typehinting is PHP Fatal error in PHP7+');
185+
}
186+
179187
try {
180188
Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache(
181189
'securityToken',

0 commit comments

Comments
 (0)