提交的内容
This commit is contained in:
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CaseConvert.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/CharacterConvert.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Concatenate.php
vendored
Executable file → Normal file
4
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php
vendored
Executable file → Normal file
4
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Extract.php
vendored
Executable file → Normal file
@ -261,7 +261,7 @@ class Extract
|
||||
$delimiter = Functions::flattenArray($delimiter);
|
||||
$quotedDelimiters = array_map(
|
||||
function ($delimiter) {
|
||||
return preg_quote($delimiter ?? '');
|
||||
return preg_quote($delimiter ?? '', '/');
|
||||
},
|
||||
$delimiter
|
||||
);
|
||||
@ -270,7 +270,7 @@ class Extract
|
||||
return '(' . $delimiters . ')';
|
||||
}
|
||||
|
||||
return '(' . preg_quote($delimiter ?? '') . ')';
|
||||
return '(' . preg_quote($delimiter ?? '', '/') . ')';
|
||||
}
|
||||
|
||||
private static function matchFlags(int $matchMode): string
|
||||
|
||||
21
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php
vendored
Executable file → Normal file
21
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Format.php
vendored
Executable file → Normal file
@ -129,7 +129,7 @@ class Format
|
||||
$format = Helpers::extractString($format);
|
||||
|
||||
if (!is_numeric($value) && Date::isDateTimeFormatCode($format)) {
|
||||
$value = DateTimeExcel\DateValue::fromString($value);
|
||||
$value = DateTimeExcel\DateValue::fromString($value) + DateTimeExcel\TimeValue::fromString($value);
|
||||
}
|
||||
|
||||
return (string) NumberFormat::toFormattedString($value, $format);
|
||||
@ -140,7 +140,7 @@ class Format
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function convertValue($value)
|
||||
private static function convertValue($value, bool $spacesMeanZero = false)
|
||||
{
|
||||
$value = $value ?? 0;
|
||||
if (is_bool($value)) {
|
||||
@ -150,6 +150,12 @@ class Format
|
||||
throw new CalcExp(ExcelError::VALUE());
|
||||
}
|
||||
}
|
||||
if (is_string($value)) {
|
||||
$value = trim($value);
|
||||
if ($spacesMeanZero && $value === '') {
|
||||
$value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -181,6 +187,9 @@ class Format
|
||||
'',
|
||||
trim($value, " \t\n\r\0\x0B" . StringHelper::getCurrencyCode())
|
||||
);
|
||||
if ($numberValue === '') {
|
||||
return ExcelError::VALUE();
|
||||
}
|
||||
if (is_numeric($numberValue)) {
|
||||
return (float) $numberValue;
|
||||
}
|
||||
@ -277,7 +286,7 @@ class Format
|
||||
}
|
||||
|
||||
try {
|
||||
$value = self::convertValue($value);
|
||||
$value = self::convertValue($value, true);
|
||||
$decimalSeparator = self::getDecimalSeparator($decimalSeparator);
|
||||
$groupSeparator = self::getGroupSeparator($groupSeparator);
|
||||
} catch (CalcExp $e) {
|
||||
@ -285,12 +294,12 @@ class Format
|
||||
}
|
||||
|
||||
if (!is_numeric($value)) {
|
||||
$decimalPositions = preg_match_all('/' . preg_quote($decimalSeparator) . '/', $value, $matches, PREG_OFFSET_CAPTURE);
|
||||
$decimalPositions = preg_match_all('/' . preg_quote($decimalSeparator, '/') . '/', $value, $matches, PREG_OFFSET_CAPTURE);
|
||||
if ($decimalPositions > 1) {
|
||||
return ExcelError::VALUE();
|
||||
}
|
||||
$decimalOffset = array_pop($matches[0])[1]; // @phpstan-ignore-line
|
||||
if (strpos($value, $groupSeparator, $decimalOffset) !== false) {
|
||||
$decimalOffset = array_pop($matches[0])[1] ?? null;
|
||||
if ($decimalOffset === null || strpos($value, $groupSeparator, $decimalOffset) !== false) {
|
||||
return ExcelError::VALUE();
|
||||
}
|
||||
|
||||
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Helpers.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Replace.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Search.php
vendored
Executable file → Normal file
4
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php
vendored
Executable file → Normal file
4
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Text.php
vendored
Executable file → Normal file
@ -193,7 +193,7 @@ class Text
|
||||
if (is_array($delimiter) && count($valueSet) > 1) {
|
||||
$quotedDelimiters = array_map(
|
||||
function ($delimiter) {
|
||||
return preg_quote($delimiter ?? '');
|
||||
return preg_quote($delimiter ?? '', '/');
|
||||
},
|
||||
$valueSet
|
||||
);
|
||||
@ -202,7 +202,7 @@ class Text
|
||||
return '(' . $delimiters . ')';
|
||||
}
|
||||
|
||||
return '(' . preg_quote(/** @scrutinizer ignore-type */ Functions::flattenSingleValue($delimiter)) . ')';
|
||||
return '(' . preg_quote(/** @scrutinizer ignore-type */ Functions::flattenSingleValue($delimiter), '/') . ')';
|
||||
}
|
||||
|
||||
private static function matchFlags(bool $matchMode): string
|
||||
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData/Trim.php
vendored
Executable file → Normal file
Reference in New Issue
Block a user