* [misc] Reinstall the Spout and PhpSpreadsheet libraries using Composer to apply the patch.

This commit is contained in:
liugang
2025-11-19 11:00:03 +08:00
parent b0990ca34a
commit 14096dcfa7
16 changed files with 129 additions and 72 deletions
+1 -1
View File
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0::getLoader();
return ComposerAutoloaderInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::getLoader();
+10 -5
View File
@@ -84,7 +84,8 @@ class RowIterator implements IteratorInterface
*
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->rewindAndSkipBom();
@@ -114,7 +115,8 @@ class RowIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return ($this->filePointer && !$this->hasReachedEndOfFile);
}
@@ -126,7 +128,8 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\EncodingConversionException If unable to convert data to UTF-8
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
$this->hasReachedEndOfFile = $this->globalFunctionsHelper->feof($this->filePointer);
@@ -224,7 +227,8 @@ class RowIterator implements IteratorInterface
*
* @return Row|null
*/
public function current(): Row|null
#[\ReturnTypeWillChange]
public function current()
{
return $this->rowBuffer;
}
@@ -235,7 +239,8 @@ class RowIterator implements IteratorInterface
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->numReadRows;
}
+10 -5
View File
@@ -30,7 +30,8 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->hasReadUniqueSheet = false;
}
@@ -41,7 +42,8 @@ class SheetIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return (!$this->hasReadUniqueSheet);
}
@@ -52,7 +54,8 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
$this->hasReadUniqueSheet = true;
}
@@ -63,7 +66,8 @@ class SheetIterator implements IteratorInterface
*
* @return \Box\Spout\Reader\CSV\Sheet
*/
public function current(): \Box\Spout\Reader\CSV\Sheet
#[\ReturnTypeWillChange]
public function current()
{
return $this->sheet;
}
@@ -74,7 +78,8 @@ class SheetIterator implements IteratorInterface
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return 1;
}
+10 -5
View File
@@ -118,7 +118,8 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Reader\Exception\IteratorNotRewindableException If the iterator is rewound more than once
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
// Because sheet and row data is located in the file, we can't rewind both the
// sheet iterator and the row iterator, as XML file cannot be read backwards.
@@ -142,7 +143,8 @@ class RowIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return (!$this->hasReachedEndOfFile);
}
@@ -155,7 +157,8 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\IOException If unable to read the sheet data XML
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
if ($this->doesNeedDataForNextRowToBeProcessed()) {
$this->readDataForNextRow();
@@ -356,7 +359,8 @@ class RowIterator implements IteratorInterface
*
* @return Row
*/
public function current(): Row
#[\ReturnTypeWillChange]
public function current()
{
return $this->rowBuffer;
}
@@ -367,7 +371,8 @@ class RowIterator implements IteratorInterface
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->lastRowIndexProcessed;
}
+10 -5
View File
@@ -79,7 +79,8 @@ class SheetIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\IOException If unable to open the XML file containing sheets' data
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->xmlReader->close();
@@ -131,7 +132,8 @@ class SheetIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->hasFoundSheet;
}
@@ -142,7 +144,8 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
$this->hasFoundSheet = $this->xmlReader->readUntilNodeFound(self::XML_NODE_TABLE);
@@ -157,7 +160,8 @@ class SheetIterator implements IteratorInterface
*
* @return \Box\Spout\Reader\ODS\Sheet
*/
public function current(): \Box\Spout\Reader\ODS\Sheet
#[\ReturnTypeWillChange]
public function current()
{
$escapedSheetName = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_TABLE_NAME);
$sheetName = $this->escaper->unescape($escapedSheetName);
@@ -214,7 +218,8 @@ class SheetIterator implements IteratorInterface
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->currentSheetIndex + 1;
}
@@ -83,7 +83,8 @@ class XMLReader extends \XMLReader
* @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred
* @return bool TRUE on success or FALSE on failure
*/
public function read(): bool
#[\ReturnTypeWillChange]
public function read()
{
$this->useXMLInternalErrors();
@@ -119,7 +120,8 @@ class XMLReader extends \XMLReader
* @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred
* @return bool TRUE on success or FALSE on failure
*/
public function next($localName = null): bool
#[\ReturnTypeWillChange]
public function next($localName = null)
{
$this->useXMLInternalErrors();
+10 -5
View File
@@ -139,7 +139,8 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\IOException If the sheet data XML cannot be read
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->xmlReader->close();
@@ -163,7 +164,8 @@ class RowIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return (!$this->hasReachedEndOfFile);
}
@@ -176,7 +178,8 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\IOException If unable to read the sheet data XML
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
$this->nextRowIndexToBeProcessed++;
@@ -374,7 +377,8 @@ class RowIterator implements IteratorInterface
*
* @return Row|null
*/
public function current(): Row|null
#[\ReturnTypeWillChange]
public function current()
{
$rowToBeProcessed = $this->rowBuffer;
@@ -399,7 +403,8 @@ class RowIterator implements IteratorInterface
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
// TODO: This should return $this->nextRowIndexToBeProcessed
// but to avoid a breaking change, the return value for
@@ -38,7 +38,8 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentSheetIndex = 0;
}
@@ -49,7 +50,8 @@ class SheetIterator implements IteratorInterface
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return ($this->currentSheetIndex < \count($this->sheets));
}
@@ -60,7 +62,8 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
// Using isset here because it is way faster than array_key_exists...
if (isset($this->sheets[$this->currentSheetIndex])) {
@@ -77,7 +80,8 @@ class SheetIterator implements IteratorInterface
*
* @return \Box\Spout\Reader\XLSX\Sheet
*/
public function current(): \Box\Spout\Reader\XLSX\Sheet
#[\ReturnTypeWillChange]
public function current()
{
return $this->sheets[$this->currentSheetIndex];
}
@@ -88,7 +92,8 @@ class SheetIterator implements IteratorInterface
*
* @return int
*/
public function key(): mixed
#[\ReturnTypeWillChange]
public function key()
{
return $this->currentSheetIndex + 1;
}
+7 -7
View File
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0
class ComposerAutoloaderInitd8f5ceb6dd2b1c87f9f3c117b97ef46e
{
private static $loader;
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd8f5ceb6dd2b1c87f9f3c117b97ef46e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd8f5ceb6dd2b1c87f9f3c117b97ef46e', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@@ -51,12 +51,12 @@ class ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire010dc2e2741263c8a65c6eb49fb81ea0($fileIdentifier, $file);
composerRequired8f5ceb6dd2b1c87f9f3c117b97ef46e($fileIdentifier, $file);
}
return $loader;
@@ -68,7 +68,7 @@ class ComposerAutoloaderInit010dc2e2741263c8a65c6eb49fb81ea0
* @param string $file
* @return void
*/
function composerRequire010dc2e2741263c8a65c6eb49fb81ea0($fileIdentifier, $file)
function composerRequired8f5ceb6dd2b1c87f9f3c117b97ef46e($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+5 -5
View File
@@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0
class ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e
{
public static $files = array (
'7e9bd612cc444b3eed788ebbe46263a0' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/autoload.php',
@@ -262,10 +262,10 @@ class ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::$prefixesPsr0;
$loader->classMap = ComposerStaticInit010dc2e2741263c8a65c6eb49fb81ea0::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::$prefixesPsr0;
$loader->classMap = ComposerStaticInitd8f5ceb6dd2b1c87f9f3c117b97ef46e::$classMap;
}, null, ClassLoader::class);
}
+2 -2
View File
@@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'c2a913f13cd2a11f9cb3c743ebcee2a1394e3034',
'reference' => 'e4941afac6ca443486032ed8e0c3fd983f07f9f0',
'name' => '__root__',
'dev' => true,
),
@@ -16,7 +16,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'c2a913f13cd2a11f9cb3c743ebcee2a1394e3034',
'reference' => 'e4941afac6ca443486032ed8e0c3fd983f07f9f0',
'dev_requirement' => false,
),
'box/spout' => array(
@@ -111,7 +111,8 @@ class ColumnCellIterator extends CellIterator
/**
* Rewind the iterator to the starting row.
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentRow = $this->startRow;
}
@@ -121,7 +122,8 @@ class ColumnCellIterator extends CellIterator
*
* @return null|\PhpOffice\PhpSpreadsheet\Cell\Cell
*/
public function current(): null|\PhpOffice\PhpSpreadsheet\Cell\Cell
#[\ReturnTypeWillChange]
public function current()
{
return $this->worksheet->getCellByColumnAndRow($this->columnIndex, $this->currentRow);
}
@@ -131,7 +133,8 @@ class ColumnCellIterator extends CellIterator
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->currentRow;
}
@@ -139,7 +142,8 @@ class ColumnCellIterator extends CellIterator
/**
* Set the iterator to its next value.
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
do {
++$this->currentRow;
@@ -165,7 +169,8 @@ class ColumnCellIterator extends CellIterator
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->currentRow <= $this->endRow && $this->currentRow >= $this->startRow;
}
@@ -122,7 +122,8 @@ class ColumnIterator implements \Iterator
/**
* Rewind the iterator to the starting column.
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentColumnIndex = $this->startColumnIndex;
}
@@ -132,7 +133,8 @@ class ColumnIterator implements \Iterator
*
* @return Column
*/
public function current(): Column
#[\ReturnTypeWillChange]
public function current()
{
return new Column($this->worksheet, Coordinate::stringFromColumnIndex($this->currentColumnIndex));
}
@@ -142,7 +144,8 @@ class ColumnIterator implements \Iterator
*
* @return string
*/
public function key(): string
#[\ReturnTypeWillChange]
public function key()
{
return Coordinate::stringFromColumnIndex($this->currentColumnIndex);
}
@@ -150,7 +153,8 @@ class ColumnIterator implements \Iterator
/**
* Set the iterator to its next value.
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
++$this->currentColumnIndex;
}
@@ -168,7 +172,8 @@ class ColumnIterator implements \Iterator
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex;
}
@@ -42,7 +42,8 @@ class Iterator implements \Iterator
/**
* Rewind iterator.
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}
@@ -52,7 +53,8 @@ class Iterator implements \Iterator
*
* @return Worksheet
*/
public function current(): Worksheet
#[\ReturnTypeWillChange]
public function current()
{
return $this->subject->getSheet($this->position);
}
@@ -62,7 +64,8 @@ class Iterator implements \Iterator
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}
@@ -70,7 +73,8 @@ class Iterator implements \Iterator
/**
* Next value.
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
}
@@ -80,7 +84,8 @@ class Iterator implements \Iterator
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->position < $this->subject->getSheetCount() && $this->position >= 0;
}
@@ -113,7 +113,8 @@ class RowCellIterator extends CellIterator
/**
* Rewind the iterator to the starting column.
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentColumnIndex = $this->startColumnIndex;
}
@@ -123,7 +124,8 @@ class RowCellIterator extends CellIterator
*
* @return \PhpOffice\PhpSpreadsheet\Cell\Cell
*/
public function current(): null|\PhpOffice\PhpSpreadsheet\Cell\Cell
#[\ReturnTypeWillChange]
public function current()
{
return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex);
}
@@ -133,7 +135,8 @@ class RowCellIterator extends CellIterator
*
* @return string
*/
public function key(): string
#[\ReturnTypeWillChange]
public function key()
{
return Coordinate::stringFromColumnIndex($this->currentColumnIndex);
}
@@ -141,7 +144,8 @@ class RowCellIterator extends CellIterator
/**
* Set the iterator to its next value.
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
do {
++$this->currentColumnIndex;
@@ -165,7 +169,8 @@ class RowCellIterator extends CellIterator
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex;
}
@@ -117,7 +117,8 @@ class RowIterator implements \Iterator
/**
* Rewind the iterator to the starting row.
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = $this->startRow;
}
@@ -127,7 +128,8 @@ class RowIterator implements \Iterator
*
* @return Row
*/
public function current(): Row
#[\ReturnTypeWillChange]
public function current()
{
return new Row($this->subject, $this->position);
}
@@ -137,7 +139,8 @@ class RowIterator implements \Iterator
*
* @return int
*/
public function key(): int
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}
@@ -145,7 +148,8 @@ class RowIterator implements \Iterator
/**
* Set the iterator to its next value.
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
}
@@ -163,7 +167,8 @@ class RowIterator implements \Iterator
*
* @return bool
*/
public function valid(): bool
#[\ReturnTypeWillChange]
public function valid()
{
return $this->position <= $this->endRow && $this->position >= $this->startRow;
}