Skip to content
Merged
Changes from all commits
Commits
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
11 changes: 5 additions & 6 deletions src/Secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OLE_PPS_File;
use OLE_PPS_Root;
use SimpleXMLElement;
use ValueError;

class Secure
{
Expand Down Expand Up @@ -468,14 +469,12 @@
*/
private function _hash($algorithm, ...$buffers)
{
$buffers = [...[], ...$buffers];

if (! in_array($algorithm, hash_algos(), true)) {
throw new Exception("Hash algorithm '{$algorithm}' not supported!"); // @codeCoverageIgnore
try {
$ctx = hash_init($algorithm);
} catch (ValueError) {
throw new Exception(sprintf("Hash algorithm '%s' not supported!", $algorithm));
}

$ctx = hash_init($algorithm);

hash_update($ctx, pack('C*', ...$buffers));

return (array) unpack('C*', hash_final($ctx, true));
Expand Down Expand Up @@ -620,7 +619,7 @@
unset($inputChunk, $outputChunk, $iv);
}

unset($this->data);

Check failure on line 622 in src/Secure.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 Static Analysis

Cannot unset property PHPDevsr\Spreadsheet\Secure::$data because it might have hooks in a subclass.

Check failure on line 622 in src/Secure.php

View workflow job for this annotation

GitHub Actions / PHP 8.5 Static Analysis

Cannot unset property PHPDevsr\Spreadsheet\Secure::$data because it might have hooks in a subclass.

file_put_contents($tmpFileHeaderLength, pack('C*', ...$this->_createUInt32LEBuffer($inputCount, $this->_offset)));

Expand Down
Loading