Skip to content

Commit dce866a

Browse files
authored
Merge pull request #119 from alchemy-fr/fix/centos-dates
Fix date parsing on Centos
2 parents 647f55c + 582c295 commit dce866a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# CHANGELOG
22

33
## [Unreleased]
4-
- No unreleased changes
4+
- #111, #115: Parsing Zip archive dates failed on CentOS
55

66
## [0.4.4] - 2016-11-03
77
### Added
8-
- #115: Add an option to override archive type detection in `Zippy::open`, similar to `Zippy::create`, courtesy of @GiantCowFilms
8+
- #116: Add an option to override archive type detection in `Zippy::open`, similar to `Zippy::create`, courtesy of @GiantCowFilms
99

1010
## [0.4.3] - 2016-11-03
1111
### Fixed

src/Parser/ZipOutputParser.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ public function parseFileListing($output)
6060
continue;
6161
}
6262

63+
$mtime = \DateTime::createFromFormat($this->dateFormat, $chunks[2]);
64+
65+
if ($mtime === false) {
66+
// See https://github.com/alchemy-fr/Zippy/issues/111#issuecomment-251668427
67+
$mtime = \DateTime::createFromFormat('H:i Y-m-d', $chunks[2]);
68+
}
69+
6370
$members[] = array(
6471
'location' => $chunks[3],
6572
'size' => $chunks[1],
66-
'mtime' => \DateTime::createFromFormat($this->dateFormat, $chunks[2]),
73+
'mtime' => $mtime,
6774
'is_dir' => '/' === substr($chunks[3], -1)
6875
);
6976
}

0 commit comments

Comments
 (0)