Skip to content

Cyclic reference with sharepoint document causes infinite loops #4791

@HMartusewiczVox

Description

@HMartusewiczVox

Client has managed to timeout our system with their XLSX file. I was able to recreate the error and I am attaching a minimal file that causes it. It has two cells:

  • A1 creates a cycle =A1:A2
  • A2 uses external document ='https://example.com/test.xlsx'#$Test.A2

cyclic-sharepoint.xlsx

The stack goes like this:

Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '512' frames in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Validations.php:116
Stack trace:
#0 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Validations.php(116): strtoupper('...')
#1 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(1422): PhpOffice\PhpSpreadsheet\Worksheet\Validations::definedNameToCoordinate('...', Object(PhpOffice\PhpSpreadsheet\Worksheet\Worksheet))
#2 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php(890): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->getStyle('...')
#3 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(656): PhpOffice\PhpSpreadsheet\Cell\Cell->getStyle()
#4 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(503): PhpOffice\PhpSpreadsheet\Calculation\Calculation->_calculateFormulaValue('...', '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#5 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php(460): PhpOffice\PhpSpreadsheet\Calculation\Calculation->calculateCellValue(Object(PhpOffice\PhpSpreadsheet\Cell\Cell), false)
#6 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(2590): PhpOffice\PhpSpreadsheet\Cell\Cell->getCalculatedValue(false)
#7 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(2048): PhpOffice\PhpSpreadsheet\Calculation\Calculation->extractCellRange('...', Object(PhpOffice\PhpSpreadsheet\Worksheet\Worksheet), false)
#8 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(708): PhpOffice\PhpSpreadsheet\Calculation\Calculation->processTokenStack(Array, '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#9 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(503): PhpOffice\PhpSpreadsheet\Calculation\Calculation->_calculateFormulaValue('...', '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#10 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php(460): PhpOffice\PhpSpreadsheet\Calculation\Calculation->calculateCellValue(Object(PhpOffice\PhpSpreadsheet\Cell\Cell), false)
#11 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(2611): PhpOffice\PhpSpreadsheet\Cell\Cell->getCalculatedValue(false)
#12 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(1835): PhpOffice\PhpSpreadsheet\Calculation\Calculation->extractCellRange('...', Object(PhpOffice\PhpSpreadsheet\Worksheet\Worksheet), false)
#13 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(708): PhpOffice\PhpSpreadsheet\Calculation\Calculation->processTokenStack(Array, '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#14 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(503): PhpOffice\PhpSpreadsheet\Calculation\Calculation->_calculateFormulaValue('...', '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#15 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php(460): PhpOffice\PhpSpreadsheet\Calculation\Calculation->calculateCellValue(Object(PhpOffice\PhpSpreadsheet\Cell\Cell), false)
#16 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(2611): PhpOffice\PhpSpreadsheet\Cell\Cell->getCalculatedValue(false)
#17 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(1835): PhpOffice\PhpSpreadsheet\Calculation\Calculation->extractCellRange('...', Object(PhpOffice\PhpSpreadsheet\Worksheet\Worksheet), false)
#18 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(708): PhpOffice\PhpSpreadsheet\Calculation\Calculation->processTokenStack(Array, '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#19 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php(503): PhpOffice\PhpSpreadsheet\Calculation\Calculation->_calculateFormulaValue('...', '...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell))
#20 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php(460): PhpOffice\PhpSpreadsheet\Calculation\Calculation->calculateCellValue(Object(PhpOffice\PhpSpreadsheet\Cell\Cell), false)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions