Skip to content

Commit 69221f1

Browse files
authored
Merge pull request #20 from fortix/create-from-stream-fix
fixed document creation from stream (ported from pear/OLE#16)
2 parents 0d2c767 + 18d6135 commit 69221f1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/MAPI/OLE/Pear/DocumentFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function createFromStream($stream): CompoundDocumentElement
5858
// Number of blocks in Short Block Allocation Table
5959
$sbbatBlockCount = $ole->_readInt4($fh);
6060
// Block id of first sector in Master Block Allocation Table
61-
$mbatFirstBlockId = $ole->_readInt4($fh);
61+
$mbatFirstBlockId = $ole->_readSignedInt4($fh);
6262
// Number of blocks in Master Block Allocation Table
6363
$mbbatBlockCount = $ole->_readInt4($fh);
6464
$ole->bbat = array();
@@ -67,7 +67,7 @@ public function createFromStream($stream): CompoundDocumentElement
6767
// Block Allocation Table
6868
$mbatBlocks = array();
6969
for ($i = 0; $i < 109; $i++) {
70-
$mbatBlocks[] = $ole->_readInt4($fh);
70+
$mbatBlocks[] = $ole->_readSignedInt4($fh);
7171
}
7272

7373
// Read rest of Master Block Allocation Table (if any is left)
@@ -87,7 +87,7 @@ public function createFromStream($stream): CompoundDocumentElement
8787
$pos = $ole->_getBlockOffset($mbatBlocks[$i]);
8888
fseek($fh, $pos);
8989
for ($j = 0 ; $j < $ole->bigBlockSize / 4; $j++) {
90-
$ole->bbat[] = $ole->_readInt4($fh);
90+
$ole->bbat[] = $ole->_readSignedInt4($fh);
9191
}
9292
}
9393

@@ -101,7 +101,7 @@ public function createFromStream($stream): CompoundDocumentElement
101101
return false;
102102
}
103103
for ($blockId = 0; $blockId < $shortBlockCount; $blockId++) {
104-
$ole->sbat[$blockId] = $ole->_readInt4($sbatFh);
104+
$ole->sbat[$blockId] = $ole->_readSignedInt4($sbatFh);
105105
}
106106
fclose($sbatFh);
107107

0 commit comments

Comments
 (0)