Skip to content
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

Xml fix namespaces #1756

Closed
wants to merge 55 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b3c2881
Fix for Xls when BIFF8 SST (FCh) has bad Shared string length
Aug 18, 2020
fa6b2de
Fix and test for bug #1592
Aug 18, 2020
07c16e9
Fix SST global limit count and improved bug test
Aug 21, 2020
5c22971
Fix SST global limit count and improved bug test
Aug 21, 2020
ae6c285
Calculation/DateTime Failure With PHP8 (#1661)
oleibman Oct 1, 2020
91cdec8
Reader/Gnumeric Failure with PHP8 (#1662)
oleibman Oct 1, 2020
98b81f1
ReverseSort bug, exposed but not caused by PHP8 (#1660)
oleibman Oct 2, 2020
c000815
Drop $this->spreadSheet null check from Xlsx Writer (#1646)
simPod Oct 2, 2020
8a9dbce
Update index.md (#1620)
Arman-Hosseini Oct 2, 2020
69c6135
Bug setting Superscript/Subscript to false (#1567)
oleibman Oct 5, 2020
a509ec4
Update CHANGELOG
PowerKiKi Oct 5, 2020
0b2c2e1
Sync README
PowerKiKi Oct 5, 2020
d87d8c8
fixed php8 deprecation warning for libxml_disable_entity_loader() (#1…
brainfoolong Oct 8, 2020
ed8bf9b
Switch from using poser badges to shields.io because poser wasn't pic…
Oct 9, 2020
30dffc3
Introduce GitHub Actions
PowerKiKi Oct 10, 2020
80bdfea
Annotate problems in code
PowerKiKi Oct 10, 2020
c6e4979
Publish API docs via GitHub Actions
PowerKiKi Oct 11, 2020
5799fee
Starting from scratch again: PHP8 nightly build included in test run,…
Aug 9, 2020
1781e24
xdebug isn't built into the nightly PHP, so we'll get an error if we …
Aug 9, 2020
5921406
<>/!=
Aug 9, 2020
887593d
Update to versions of complex and matrix libraries
Sep 1, 2020
254dcdc
Update to versions of complex and matrix libraries
Oct 1, 2020
516b63c
Separate compoer.json for PHP8 to enforce phpunit ^9.3
Oct 8, 2020
948a6f0
We don't want the composer lock file for PHP8
Oct 8, 2020
f6816ae
Work with existing composer file; but force a fresh install to requir…
Oct 8, 2020
b8ebd3f
Allow failures on nightly
Oct 8, 2020
9a7d8c9
Allow failures on nightly fails if we remove it from the grid
Oct 8, 2020
2973818
Use ZipArchive methods as zip_* functions are deprecated in PHP8
Oct 9, 2020
997ed88
Remove tests that include tcPDF and DomPDF libraries when running aga…
Oct 9, 2020
15e712a
Let's try to figure out why we're having an issue with a temp csv file
Oct 9, 2020
14c0018
Need to add `application/csv` to the list of valid CSV mime types
Oct 9, 2020
25ce484
Locale-specific float to string is changed in PHP as per https://wiki…
Oct 9, 2020
892244e
Codestyle clean-ups
Oct 9, 2020
82143be
Update composer suggestions
Oct 10, 2020
7791931
Update composer suggestions
Oct 11, 2020
eb1c64e
Test PHP 8 on GitHub Actions
PowerKiKi Oct 11, 2020
fb949f7
Improving Coverage for Excel2003 XML Reader (#1557)
oleibman Oct 11, 2020
e233a9b
Update CHANGELOG
PowerKiKi Oct 11, 2020
741d775
1.15.0
PowerKiKi Oct 11, 2020
c4ad454
Remove coverage from Travis
PowerKiKi Oct 11, 2020
1e83bde
Prepare for next version
PowerKiKi Oct 11, 2020
0b0a235
Ensure that the list of shared formulae is maintained while chunk-rea…
Oct 12, 2020
c531984
Prevent notice during accessing "cached magnification factor" offset
Sep 21, 2020
afea231
Refresh lock files
PowerKiKi Oct 19, 2020
fea1a77
Add exportArray Method for Styles (#1580)
oleibman Oct 26, 2020
3468199
Updating a misspelling of a function name. (#1695)
CoryHrycko Nov 1, 2020
62fd60b
Make DefinedNames Samples Consistent With Other Samples (#1707)
oleibman Nov 11, 2020
3a3d264
Resolve XSS Vulnerability in the HTML Writer (#1719)
Nov 19, 2020
51a9e31
Drop Travis
PowerKiKi Nov 26, 2020
6789bf8
Automatic GitHub releases from git tags
PowerKiKi Nov 26, 2020
bcf8fb3
Improve Coverage in src/PhpSpreadsheet
oleibman Nov 27, 2020
2d1375e
Changes for Scrutinizer
oleibman Nov 27, 2020
c261e62
Merged upstream/master
Dec 14, 2020
d139613
XmlReader fix global namespace not detected when defined in root node…
Dec 14, 2020
2bafc47
Merge remote-tracking branch 'upstream/master' into xml-fix-namespaces
Jan 27, 2021
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
Prev Previous commit
Next Next commit
Fix SST global limit count and improved bug test
  • Loading branch information
Gianluca Giovinazzo committed Aug 21, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 07c16e9e658a048b2ecbdcb2aad7942531b6e770
54 changes: 27 additions & 27 deletions src/PhpSpreadsheet/Reader/Xls.php
Original file line number Diff line number Diff line change
@@ -1290,7 +1290,7 @@ public function load($pFilename)
}
}
// Named Value
// TODO Provide support for named values
// TODO Provide support for named values
}
}
$this->data = null;
@@ -1302,8 +1302,8 @@ public function load($pFilename)
* Read record data from stream, decrypting as required.
*
* @param string $data Data stream to read from
* @param int $pos Position to start reading from
* @param int $len Record data length
* @param int $pos Position to start reading from
* @param int $len Record data length
*
* @return string Record data
*/
@@ -1670,8 +1670,8 @@ private function readDefault(): void
}

/**
* The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions,
* this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
* The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier
* versions, this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
*/
private function readNote(): void
{
@@ -1718,7 +1718,7 @@ private function readNote(): void
} else {
// Set comment for the cell
$this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText));
// ->setAuthor($author)
// ->setAuthor($author)
}
}
}
@@ -1850,7 +1850,7 @@ private function readFilepass(): void
/**
* Make an RC4 decryptor for the given block.
*
* @param int $block Block for which to create decrypto
* @param int $block Block for which to create decrypto
* @param string $valContext MD5 context state
*
* @return Xls\RC4
@@ -1882,11 +1882,11 @@ private function makeKey($block, $valContext)
/**
* Verify RC4 file password.
*
* @param string $password Password to check
* @param string $docid Document id
* @param string $salt_data Salt data
* @param string $password Password to check
* @param string $docid Document id
* @param string $salt_data Salt data
* @param string $hashedsalt_data Hashed salt data
* @param string $valContext Set to the MD5 context of the value
* @param string $valContext Set to the MD5 context of the value
*
* @return bool Success
*/
@@ -2974,7 +2974,7 @@ private function readSst(): void
$pos = 0;

// Limit position, further control for bad SST Length in BIFF8 data
$limitpos = 0;
$limitposSST = 0;

// get spliced record data
$splicedRecordData = $this->getSplicedRecordData();
@@ -2994,14 +2994,12 @@ private function readSst(): void
// it can happen that the string is empty, therefore we need
// <= and not just <
if ($pos <= $spliceOffset) {
$limitpos = $spliceOffset;

break;
$limitposSST = $spliceOffset;
}
}

// loop through the Unicode strings (16-bit length)
for ($i = 0; $i < $nm && $pos < $limitpos; ++$i) {
for ($i = 0; $i < $nm && $pos < $limitposSST; ++$i) {
// number of characters in the Unicode string
$numChars = self::getUInt2d($recordData, $pos);
$pos += 2;
@@ -3099,7 +3097,7 @@ private function readSst(): void
$len = min($charsLeft, $limitpos - $pos);
for ($j = 0; $j < $len; ++$j) {
$retstr .= $recordData[$pos + $j]
. chr(0);
. chr(0);
}
$charsLeft -= $len;
$isCompressed = false;
@@ -5317,7 +5315,8 @@ private function getSplicedRecordData()
* Convert formula structure into human readable Excel formula like 'A3+A5*5'.
*
* @param string $formulaStructure The complete binary data for the formula
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared
* formulas
*
* @return string Human readable formula
*/
@@ -5342,9 +5341,10 @@ private function getFormulaFromStructure($formulaStructure, $baseCell = 'A1')
/**
* Take formula data and additional data for formula and return human readable formula.
*
* @param string $formulaData The binary data for the formula itself
* @param string $formulaData The binary data for the formula itself
* @param string $additionalData Additional binary data going with the formula
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared
* formulas
*
* @return string Human readable formula
*/
@@ -5366,7 +5366,7 @@ private function getFormulaFromData($formulaData, $additionalData = '', $baseCel
/**
* Take array of tokens together with additional data for formula and return human readable formula.
*
* @param array $tokens
* @param array $tokens
* @param string $additionalData Additional binary data going with the formula
*
* @return string Human readable formula
@@ -5542,7 +5542,7 @@ private function createFormulaFromTokens($tokens, $additionalData)
* Fetch next token from binary formula data.
*
* @param string $formulaData Formula data
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
*
* @return array
*/
@@ -7758,7 +7758,7 @@ private static function readUnicodeStringLong($subData)
* OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3.
*
* @param string $subData
* @param int $characterCount
* @param int $characterCount
*
* @return array
*/
@@ -7865,7 +7865,7 @@ private static function getIEEE754($rknum)
* Get UTF-8 string from (compressed or uncompressed) UTF-16 string.
*
* @param string $string
* @param bool $compressed
* @param bool $compressed
*
* @return string
*/
@@ -7912,7 +7912,7 @@ private function decodeCodepage($string)
* Read 16-bit unsigned integer.
*
* @param string $data
* @param int $pos
* @param int $pos
*
* @return int
*/
@@ -7925,7 +7925,7 @@ public static function getUInt2d($data, $pos)
* Read 16-bit signed integer.
*
* @param string $data
* @param int $pos
* @param int $pos
*
* @return int
*/
@@ -7938,7 +7938,7 @@ public static function getInt2d($data, $pos)
* Read 32-bit signed integer.
*
* @param string $data
* @param int $pos
* @param int $pos
*
* @return int
*/
13 changes: 11 additions & 2 deletions tests/PhpSpreadsheetTests/Reader/XlsTest.php
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ public function testLoadXlsBug1592(): void
$sheet = $spreadsheet->getActiveSheet();
$col = $sheet->getHighestColumn();
$row = $sheet->getHighestRow();

$newspreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx');
$newsheet = $newspreadsheet->getActiveSheet();
$newcol = $newsheet->getHighestColumn();
@@ -66,7 +67,15 @@ public function testLoadXlsBug1592(): void
self::assertEquals($sheet->getColumnDimensions(), $newsheet->getColumnDimensions());
self::assertEquals($col, $newcol);
self::assertEquals($row, $newrow);
self::assertEquals($sheet->getCell('A1')->getFormattedValue(), $newsheet->getCell('A1')->getFormattedValue());
self::assertEquals($sheet->getCell("$col$row")->getFormattedValue(), $newsheet->getCell("$col$row")->getFormattedValue());

$rowIterator = $sheet->getRowIterator();

foreach ($rowIterator as $row) {
foreach ($row->getCellIterator() as $cell) {
$valOld = $cell->getFormattedValue();
$valNew = $newsheet->getCell($cell->getCoordinate())->getFormattedValue();
self::assertEquals($valOld, $valNew);
}
}
}
}