Remove unnecessary changes. Added test

This commit is contained in:
Tiago Fernandes 2021-04-19 11:25:48 +01:00
parent c673653c54
commit 559c0761df
3 changed files with 20 additions and 3 deletions

View File

@ -48,7 +48,6 @@ class Xlsx extends BaseReader
* @var ReferenceHelper
*/
private $referenceHelper;
/**
* Xlsx\Theme instance.
*
@ -471,10 +470,9 @@ class Xlsx extends BaseReader
}
$xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
$xpathPath = strpos($xpath['Target'], '/') === 0 ? substr($xpath['Target'], 1) : "$dir/$xpath[Target]";
//~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"
$xmlStyles = simplexml_load_string(
$this->securityScanner->scan($this->getFromZipArchive($zip, $xpathPath)),
$this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")),
'SimpleXMLElement',
Settings::getLibXmlLoaderOptions()
);

View File

@ -0,0 +1,19 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PHPUnit\Framework\TestCase;
class AbsolutePathTest extends TestCase
{
public static function testPr1869(): void
{
$xlsxFile = 'tests/data/Reader/XLSX/pr1769e.xlsx';
$reader = new Xlsx();
$result = $reader->listWorksheetInfo($xlsxFile);
self::assertIsArray($result);
self::assertEquals(3, $result[0]['totalRows']);
}
}

Binary file not shown.