Skip to content

Commit 1d01da7

Browse files
committed
Make compatible with XP9, drop PHP 5.5
1 parent d7f76cf commit 1d01da7

17 files changed

+40
-36
lines changed

.travis.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
language: php
44

5-
sudo: false
6-
75
php:
8-
- 5.5
96
- 5.6
107
- 7.0
118
- 7.1
@@ -14,17 +11,12 @@ php:
1411

1512
matrix:
1613
allow_failures:
17-
- php: hhvm
1814
- php: nightly
1915

2016
before_script:
21-
- wget 'https://github.com/xp-framework/xp-runners/releases/download/v6.3.0/setup' -O - | php
17+
- curl -sSL https://dl.bintray.com/xp-runners/generic/xp-run-master.sh > xp-run
2218
- composer install --prefer-dist
2319
- echo "vendor/autoload.php" > composer.pth
24-
- echo "use=vendor/xp-framework/core" > xp.ini
25-
- echo "[runtime]" >> xp.ini
26-
- echo "date.timezone=Europe/Berlin" >> xp.ini
2720

2821
script:
29-
- ./unittest src/test/php
30-
22+
- sh xp-run xp.unittest.TestRunner src/test/php

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ ZIP File support for the XP Framework ChangeLog
33

44
## ?.?.? / ????-??-??
55

6+
## 8.0.0 / 2017-09-24
7+
8+
* **Heads up**: Dropped PHP 5.5 support - @thekid
9+
* Added compatibility with XP 9.0+ - @thekid
10+
* Dropped dependency on `xp-framework/security` library - @thekid
11+
612
## 7.1.0 / 2016-08-29
713

814
* Added forward compatibility with XP 8.0.0: Use File::in() instead of

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
"description" : "ZIP File support for the XP Framework",
77
"keywords": ["module", "xp"],
88
"require" : {
9-
"xp-framework/core": "^8.0 | ^7.0 | ^6.5",
10-
"xp-framework/security": "^7.0 | ^6.6",
11-
"xp-framework/math": "^7.0 | ^6.6",
12-
"php" : ">=5.5.0"
9+
"xp-framework/core": "^9.0 | ^8.0 | ^7.0 | ^6.5",
10+
"xp-framework/math": "^8.0 | ^7.0 | ^6.6",
11+
"php" : ">=5.6.0"
1312
},
1413
"require-dev" : {
15-
"xp-framework/unittest": "^7.0 | ^6.5"
14+
"xp-framework/unittest": "^9.0 | ^8.0 | ^7.0 | ^6.5"
1615
},
1716
"autoload" : {
1817
"files" : ["src/main/php/autoload.php"]

src/main/php/io/archive/zip/AbstractZipReaderImpl.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @ext iconv
1212
*/
13-
abstract class AbstractZipReaderImpl extends \lang\Object {
13+
abstract class AbstractZipReaderImpl {
1414
public $skip= 0;
1515

1616
protected $stream= null;

src/main/php/io/archive/zip/CipheringZipFileOutputStream.class.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
use io\streams\OutputStream;
44
use io\streams\MemoryOutputStream;
5-
use security\checksum\CRC32;
65

76
/**
87
* Output stream for files
98
*
109
* @see xp://io.archive.zip.ZipArchiveWriter#addFile
1110
*/
12-
class CipheringZipFileOutputStream extends \lang\Object implements OutputStream {
11+
class CipheringZipFileOutputStream implements OutputStream {
1312
protected
1413
$writer = null,
1514
$compression = null,
@@ -33,7 +32,7 @@ public function __construct(ZipArchiveWriter $writer, ZipFileEntry $file, $name,
3332
$this->file= $file;
3433
$this->name= $name;
3534
$this->data= null;
36-
$this->md= CRC32::digest();
35+
$this->md= hash_init('crc32b');
3736
$this->cipher= $cipher;
3837
}
3938

@@ -57,7 +56,7 @@ public function withCompression(Compression $compression, $level= 6) {
5756
*/
5857
public function write($arg) {
5958
$this->size+= strlen($arg);
60-
$this->md->update($arg);
59+
hash_update($this->md, $arg);
6160
$this->data->write($arg);
6261
}
6362

@@ -77,7 +76,10 @@ public function close() {
7776
if (null === $this->data) return; // Already written
7877

7978
// Calculate CRC32
80-
$crc32= (new CRC32($this->md->digest()))->asInt32();
79+
$crc32= hexdec(hash_final($this->md));
80+
if ($crc32 > 2147483647) { // Convert from uint32 to int32
81+
$crc32= intval($crc32 - 4294967296);
82+
}
8183

8284
// Create random bytes
8385
$rand= '';

src/main/php/io/archive/zip/DecipheringInputStream.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @see xp://io.archive.zip.ZipCipher
99
*/
10-
class DecipheringInputStream extends \lang\Object implements InputStream {
10+
class DecipheringInputStream implements InputStream {
1111
protected $in= null;
1212
protected $cipher= null;
1313

src/main/php/io/archive/zip/ZipArchiveReader.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* @test xp://net.xp_framework.unittest.io.archive.ZipFileIteratorTest
2929
* @see xp://io.archive.zip.ZipArchive#open
3030
*/
31-
class ZipArchiveReader extends \lang\Object {
31+
class ZipArchiveReader {
3232
protected $impl= NULL;
3333

3434
/**

src/main/php/io/archive/zip/ZipArchiveWriter.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @see xp://io.archive.zip.ZipArchive#create
1111
* @test xp://io.archive.zip.unittest.ZipArchiveWriterTest
1212
*/
13-
class ZipArchiveWriter extends \lang\Object {
13+
class ZipArchiveWriter {
1414
protected
1515
$stream = null,
1616
$dir = [],

src/main/php/io/archive/zip/ZipCipher.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @test xp://net.xp_framework.unittest.io.archive.vendors.SevenZipFileTest
99
* @see http://www.pkware.com/documents/casestudies/APPNOTE.TXT
1010
*/
11-
class ZipCipher extends \lang\Object {
11+
class ZipCipher {
1212
protected $keys= null;
1313

1414
// Calculated by Vbaccelerator.Components.Algorithms.CRC32 class seen at

src/main/php/io/archive/zip/ZipDirEntry.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @see xp://io.archive.zip.ZipEntry
1010
* @purpose Interface
1111
*/
12-
class ZipDirEntry extends \lang\Object implements ZipEntry {
12+
class ZipDirEntry implements ZipEntry {
1313
protected
1414
$name = '',
1515
$mod = null,

0 commit comments

Comments
 (0)