Merge pull request #1769 from tiagof/issue-907-absolute-path-in-Target
Handle absolute path in worksheets Target
This commit is contained in:
commit
62f5135dc4
|
|
@ -110,6 +110,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue with absolute path in worksheets' Target. [PR #1769](https://github.com/PHPOffice/PhpSpreadsheet/pull/1769)
|
||||
- Fix for Xls Reader when SST has a bad length [#1592](https://github.com/PHPOffice/PhpSpreadsheet/issues/1592)
|
||||
- Resolve Xlsx loader issue whe hyperlinks don't have a destination
|
||||
- Resolve issues when printer settings resources IDs clash with drawing IDs
|
||||
|
|
|
|||
|
|
@ -198,11 +198,12 @@ class Xlsx extends BaseReader
|
|||
];
|
||||
|
||||
$fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')];
|
||||
$fileWorksheetPath = strpos($fileWorksheet, '/') === 0 ? substr($fileWorksheet, 1) : "$dir/$fileWorksheet";
|
||||
|
||||
$xml = new XMLReader();
|
||||
$xml->xml(
|
||||
$this->securityScanner->scanFile(
|
||||
'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet"
|
||||
'zip://' . File::realpath($pFilename) . '#' . $fileWorksheetPath
|
||||
),
|
||||
null,
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
|
|
|
|||
|
|
@ -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.
Loading…
Reference in New Issue