Files
PhpSpreadsheet/tests/data/Cell/DefaultValueBinder.php
T
oleibman e92b538efa Strings That Look Like Huge Floating Point Numbers
Fix #4776. DefaultValueBinder treats strings that look like scientific notation as floats. However, if Php evaluates them as `INF`, this can cause problems for Excel. A one-line change to DefaultValueBinder avoids this situation. Tests are added for DefaultValueBinder, and also for StringValueBinder and AdvancedValueBinder, although those extend DefaultValueBinder and needed no code changes.
2026-01-01 17:50:36 -08:00

93 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
return [
[
'null',
null,
],
[
'e',
'#NULL!',
],
[
'b',
false,
],
[
'b',
true,
],
[
's',
'FALSE',
],
[
's',
'TRUE',
],
[
's',
'',
],
[
's',
'ABC',
],
[
'n',
'123',
],
[
'n',
123,
],
[
'n',
0.123,
],
[
'n',
'-123',
],
[
'n',
'1.23E4',
],
[
'n',
'-1.23E4',
],
[
'n',
'1.23E-4',
],
[
's',
'000123',
],
[
'f',
'=123',
],
[
'e',
'#DIV/0!',
],
[
's',
'123456\n',
],
'Numeric that exceeds PHP MAX_INT Size' => [
's',
'1234567890123459012345689012345690',
],
'Issue 1310 Multiple = at start' => ['s', '======'],
'Issue 1310 Variant 1' => ['s', '= ====='],
'Issue 1310 Variant 2' => ['s', '=2*3='],
'Issue 4766 very large positive exponent treated as string' => ['s', '4E433'],
'Issue 4766 very large negative exponent numeric' => ['n', '4E-433'],
'Issue 4766 small exponent no decimal point numeric' => ['n', '4E4'],
];