Skip to content

Release 0.2.8 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d464b88
Assert zip adapters return values
PowerKiKi Feb 26, 2017
5aaa2f6
Merge pull request #14 from PowerKiKi/zip
Progi1984 Mar 13, 2017
ebdfee3
Utility to get an Office compatible hash of a password
troosan Nov 24, 2017
93e2de8
Scrutinizer fixes
troosan Nov 24, 2017
024bace
Assert zip adapters return values
PowerKiKi Feb 26, 2017
3deecee
Utility to get an Office compatible hash of a password
troosan Nov 24, 2017
90551b1
Scrutinizer fixes
troosan Nov 24, 2017
2e2120e
Merge branch 'add_password_hash' of https://github.com/troosan/Common…
troosan Nov 25, 2017
99f3853
formatting
troosan Nov 25, 2017
9a47eda
modified method to take string as input instead of algorithmSid
troosan Nov 25, 2017
9fbcbe3
Unit tests on PHP 7.1 & PHP 7.2
Progi1984 Dec 1, 2017
39209e6
Unit tests on PHP 7.1 & PHP 7.2
Progi1984 Dec 1, 2017
b5198e9
Merge pull request #16 from PHPOffice/testsVersionPhp
Progi1984 Dec 1, 2017
cf94f10
Merge branch 'develop' into add_password_hash
troosan Dec 1, 2017
b388d31
Merge branch 'develop' into add_password_hash
troosan Dec 1, 2017
291e2e0
add possibility to register namespaces to DOMXpath
troosan Dec 13, 2017
7b8d18a
code formatting
troosan Dec 13, 2017
bbc5874
Merge branch 'add_password_hash' of https://github.com/troosan/Common…
troosan Dec 13, 2017
6241c5b
add method to get algorithm id from name
troosan Dec 13, 2017
67bc52a
Clean elses
carusogabriel Dec 14, 2017
f60875f
Add tests for the XMLReader class
troosan Dec 16, 2017
75b7a6f
format code
troosan Dec 16, 2017
bb41d13
Merge pull request #18 from carusogabriel/clean-elses
Progi1984 Dec 18, 2017
5d35fcf
Merge pull request #17 from troosan/add_register_namespace_to_xml_reader
Progi1984 Dec 18, 2017
89e2fd3
restore the isUTF8 method
troosan Feb 17, 2018
ed83841
copy/paste issue
troosan Feb 17, 2018
3a4c839
Merge pull request #19 from troosan/un-deprecate_is_utf8
Progi1984 Feb 19, 2018
2648b3c
Write attribute's value of type float independently of locale
Trainmaster Apr 10, 2018
47b3183
Try different locale
Trainmaster Apr 10, 2018
2cf7240
Merge pull request #21 from Trainmaster/fix-write-attribute-with-floa…
Progi1984 May 23, 2018
b77fa41
fix typos
troosan May 23, 2018
d489595
Merge pull request #15 from troosan/add_password_hash
Progi1984 May 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

matrix:
allow_failures:
- php: 7.1
- php: 7.2
- php: hhvm

env:
Expand Down
13 changes: 0 additions & 13 deletions src/Common/Adapter/Zip/PclZipAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,18 @@ class PclZipAdapter implements ZipInterface
*/
protected $tmpDir;

/**
* @param $filename
* @return $this
*/
public function open($filename)
{
$this->oPclZip = new PclZip($filename);
$this->tmpDir = sys_get_temp_dir();
return $this;
}

/**
* @return $this
*/
public function close()
{
return $this;
}

/**
* @param $localname
* @param $contents
* @return $this
* @throws \Exception
*/
public function addFromString($localname, $contents)
{
$pathData = pathinfo($localname);
Expand Down
20 changes: 5 additions & 15 deletions src/Common/Adapter/Zip/ZipArchiveAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ class ZipArchiveAdapter implements ZipInterface
*/
protected $filename;

/**
* @param string $filename
* @throws \Exception Could not open $this->filename for writing.
* @return mixed
*/
public function open($filename)
{
$this->filename = $filename;
Expand All @@ -35,10 +30,6 @@ public function open($filename)
throw new \Exception("Could not open $this->filename for writing.");
}

/**
* @return $this
* @throws \Exception Could not close zip file $this->filename.
*/
public function close()
{
if ($this->oZipArchive->close() === false) {
Expand All @@ -47,13 +38,12 @@ public function close()
return $this;
}

/**
* @param $localname
* @param $contents
* @return bool
*/
public function addFromString($localname, $contents)
{
return $this->oZipArchive->addFromString($localname, $contents);
if ($this->oZipArchive->addFromString($localname, $contents) === false) {
throw new \Exception("Error zipping files : " . $localname);
}

return $this;
}
}
20 changes: 20 additions & 0 deletions src/Common/Adapter/Zip/ZipInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@

interface ZipInterface
{
/**
* Open a ZIP file archive
* @param string $filename
* @return $this
* @throws \Exception
*/
public function open($filename);

/**
* Close the active archive (opened or newly created)
* @return $this
* @throws \Exception
*/
public function close();

/**
* Add a file to a ZIP archive using its contents
* @param string $localname The name of the entry to create.
* @param string $contents The contents to use to create the entry. It is used in a binary safe mode.
* @return $this
* @throws \Exception
*/
public function addFromString($localname, $contents);
}
10 changes: 5 additions & 5 deletions src/Common/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public static function fileExists($pFilename)
$zip->close();

return $returnValue;
} else {
return false;
}
} else {
// Regular file_exists
return file_exists($pFilename);

return false;
}

// Regular file_exists
return file_exists($pFilename);
}
/**
* Returns the content of a file
Expand Down
34 changes: 17 additions & 17 deletions src/Common/Microsoft/OLERead.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,26 @@ public function getStream($stream)
}

return $streamData;
} else {
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
++$numBlocks;
}
}

if ($numBlocks == 0) {
return '';
}
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
++$numBlocks;
}

$block = $this->props[$stream]['startBlock'];
if ($numBlocks == 0) {
return '';
}

while ($block != -2) {
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
$block = self::getInt4d($this->bigBlockChain, $block*4);
}
$block = $this->props[$stream]['startBlock'];

return $streamData;
while ($block != -2) {
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
$block = self::getInt4d($this->bigBlockChain, $block*4);
}

return $streamData;
}

/**
Expand Down Expand Up @@ -259,10 +259,10 @@ private function readPropertySets()
'type' => $type,
'startBlock' => $startBlock,
'size' => $size);

// tmp helper to simplify checks
$upName = strtoupper($name);

switch ($upName) {
case 'ROOT ENTRY':
case 'R':
Expand Down
Loading