Fix parsing allinfo result

This commit is contained in:
Robin Appelman 2016-08-26 22:57:15 +02:00
commit 2754259528
2 changed files with 33 additions and 1 deletions

View file

@ -108,7 +108,7 @@ class Parser {
if ($name === 'write_time') { if ($name === 'write_time') {
$mtime = strtotime($value); $mtime = strtotime($value);
} else if ($name === 'attributes') { } else if ($name === 'attributes') {
$mode = hexdec(substr($value, 1, -1)); $mode = hexdec(substr($value, strpos($value, '('), -1));
} else if ($name === 'stream') { } else if ($name === 'stream') {
list(, $size,) = explode(' ', $value); list(, $size,) = explode(' ', $value);
$size = intval($size); $size = intval($size);

View file

@ -63,6 +63,38 @@ class Parser extends \PHPUnit_Framework_TestCase {
'mode' => FileInfo::MODE_NORMAL, 'mode' => FileInfo::MODE_NORMAL,
'size' => 29634 'size' => 29634
) )
),
array(
array(
'altname: folder',
'create_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'access_time: Tue Oct 15 02:58:48 PM 2013 CEST',
'write_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'change_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'attributes: D (10)',
'stream: [::$DATA], 29634 bytes'
),
array(
'mtime' => strtotime('12 Oct 2013 19:05:58 CEST'),
'mode' => FileInfo::MODE_DIRECTORY,
'size' => 29634
)
),
array(
array(
'altname: .hidden',
'create_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'access_time: Tue Oct 15 02:58:48 PM 2013 CEST',
'write_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'change_time: Sat Oct 12 07:05:58 PM 2013 CEST',
'attributes: HA (22)',
'stream: [::$DATA], 29634 bytes'
),
array(
'mtime' => strtotime('12 Oct 2013 19:05:58 CEST'),
'mode' => FileInfo::MODE_HIDDEN + FileInfo::MODE_ARCHIVE,
'size' => 29634
)
) )
); );
} }