Skip to content

Commit ea490a1

Browse files
committed
Remove Unwanted Tests
1 parent fcc781d commit ea490a1

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ public static function evaluate(mixed $roman): array|int|string
7474
// Convert the roman numeral to an arabic number
7575
$negativeNumber = $roman[0] === '-';
7676
if ($negativeNumber) {
77-
$roman = substr($roman, 1);
77+
$roman = trim(substr($roman, 1));
78+
if ($roman === '') {
79+
return ExcelError::NAN();
80+
}
7881
}
7982

8083
try {
81-
$arabic = self::calculateArabic(str_split($roman));
84+
$arabic = self::calculateArabic(mb_str_split($roman));
8285
} catch (Exception) {
8386
return ExcelError::VALUE(); // Invalid character detected
8487
}

src/PhpSpreadsheet/Reader/Security/XmlScanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private function findCharSet(string $xml): string
8787
public function scan($xml): string
8888
{
8989
// Don't rely purely on libxml_disable_entity_loader()
90-
$pattern = '/\0*' . implode('\0*', str_split($this->pattern)) . '\0*/';
90+
$pattern = '/\0*' . implode('\0*', mb_str_split($this->pattern)) . '\0*/';
9191

9292
$xml = "$xml";
9393
if (preg_match($pattern, $xml)) {

tests/data/Calculation/Engineering/HEX2DEC.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
['4886718345', '123456789'],
1313
[ExcelError::NAN(), '123.45'],
1414
['0', '0'],
15-
[11, 'A2'],
16-
[0, 'A3'],
17-
[0, ''],
15+
['0', ''],
1816
[ExcelError::NAN(), 'G3579A'],
1917
[ExcelError::VALUE(), true],
2018
[ExcelError::VALUE(), false],

tests/data/Calculation/Engineering/OCT2DEC.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
[ExcelError::NAN(), '3579'],
1616
['44', '54'],
1717
['-165', '7777777533'], // 2's Complement
18-
['65', 'A2'],
19-
['0', 'A3'],
2018
['0', ''],
2119
[ExcelError::NAN(), '37777777770'], // too many digits
2220
['536870911', '3777777777'], // highest positive

tests/data/Calculation/MathTrig/ARABIC.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@
6363
0,
6464
'',
6565
],
66+
[
67+
'#NUM!',
68+
'-',
69+
],
6670
];

0 commit comments

Comments
 (0)