Skip to content

Commit dde197d

Browse files
authored
Merge branch 'master' into nodtdload
2 parents 4d902d1 + c01b94b commit dde197d

File tree

27 files changed

+225
-98
lines changed

27 files changed

+225
-98
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- '8.1'
1414
- '8.2'
1515
- '8.3'
16+
- '8.4'
1617

1718
include:
1819
- php-version: 'nightly'

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2222
### Deprecated
2323

2424
- Settings::setLibXmlLoaderOptions() and Settings::getLibXmlLoaderOptions() are no longer needed - no replacement.
25+
- Worksheet::getHashCode is no longer needed.
2526

2627
### Fixed
2728

28-
- Nothing yet.
29+
- Add support for `<s>` tag when converting HTML to RichText. [Issue #4223](https://github.com/PHPOffice/PhpSpreadsheet/issues/4223) [PR #4224](https://github.com/PHPOffice/PhpSpreadsheet/pull/4224)
30+
- Change hash code for worksheet. [Issue #4192](https://github.com/PHPOffice/PhpSpreadsheet/issues/4192) [PR #4207](https://github.com/PHPOffice/PhpSpreadsheet/pull/4207)
2931

3032
## 2024-11-10 - 3.4.0
3133

composer.lock

Lines changed: 48 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,9 +4149,9 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
41494149
$expectedArgumentCountString = null;
41504150
if (is_numeric($expectedArgumentCount)) {
41514151
if ($expectedArgumentCount < 0) {
4152-
if ($argumentCount > abs($expectedArgumentCount)) {
4152+
if ($argumentCount > abs($expectedArgumentCount + 0)) {
41534153
$argumentCountError = true;
4154-
$expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount);
4154+
$expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount + 0);
41554155
}
41564156
} else {
41574157
if ($argumentCount != $expectedArgumentCount) {
@@ -4236,7 +4236,7 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
42364236
// do we now have a function/variable/number?
42374237
$expectingOperator = true;
42384238
$expectingOperand = false;
4239-
$val = $match[1] ?? '';
4239+
$val = $match[1] ?? ''; //* @phpstan-ignore-line
42404240
$length = strlen($val);
42414241

42424242
if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $val, $matches)) {

src/PhpSpreadsheet/Calculation/Engineering/BitWise.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private static function validateShiftAmount(mixed $value): int
221221
$value = self::nullFalseTrueToNumber($value);
222222

223223
if (is_numeric($value)) {
224-
if (abs($value) > 53) {
224+
if (abs($value + 0) > 53) {
225225
throw new Exception(ExcelError::NAN());
226226
}
227227

src/PhpSpreadsheet/Calculation/Financial/CashFlow/Variable/NonPeriodic.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ private static function xirrBisection(array $values, array $dates, float $x1, fl
239239
return $rslt;
240240
}
241241

242+
/** @param array<int,float|int|numeric-string> $values> */
242243
private static function xnpvOrdered(mixed $rate, mixed $values, mixed $dates, bool $ordered = true, bool $capAtNegative1 = false): float|string
243244
{
244245
$rate = Functions::flattenSingleValue($rate);
@@ -276,7 +277,7 @@ private static function xnpvOrdered(mixed $rate, mixed $values, mixed $dates, bo
276277
return $dif;
277278
}
278279
if ($rate <= -1.0) {
279-
$xnpv += -abs($values[$i]) / (-1 - $rate) ** ($dif / 365);
280+
$xnpv += -abs($values[$i] + 0) / (-1 - $rate) ** ($dif / 365);
280281
} else {
281282
$xnpv += $values[$i] / (1 + $rate) ** ($dif / 365);
282283
}

src/PhpSpreadsheet/Cell/Cell.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function setValueExplicit(mixed $value, string $dataType = DataType::TYPE
324324
self::updateIfCellIsTableHeader($this->getParent()?->getParent(), $this, $oldValue, $value);
325325
$worksheet = $this->getWorksheet();
326326
$spreadsheet = $worksheet->getParent();
327-
if (isset($spreadsheet)) {
327+
if (isset($spreadsheet) && $spreadsheet->getIndex($worksheet, true) >= 0) {
328328
$originalSelected = $worksheet->getSelectedCells();
329329
$activeSheetIndex = $spreadsheet->getActiveSheetIndex();
330330
$style = $this->getStyle();

src/PhpSpreadsheet/Helper/Html.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ class Html
561561
'u' => [self::class, 'startUnderlineTag'],
562562
'ins' => [self::class, 'startUnderlineTag'],
563563
'del' => [self::class, 'startStrikethruTag'],
564+
's' => [self::class, 'startStrikethruTag'],
564565
'sup' => [self::class, 'startSuperscriptTag'],
565566
'sub' => [self::class, 'startSubscriptTag'],
566567
];
@@ -575,6 +576,7 @@ class Html
575576
'u' => [self::class, 'endUnderlineTag'],
576577
'ins' => [self::class, 'endUnderlineTag'],
577578
'del' => [self::class, 'endStrikethruTag'],
579+
's' => [self::class, 'endStrikethruTag'],
578580
'sup' => [self::class, 'endSuperscriptTag'],
579581
'sub' => [self::class, 'endSubscriptTag'],
580582
'br' => [self::class, 'breakTag'],

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class Xls extends XlsBase
234234
* The current MD5 context state.
235235
* It is never set in the program, so code which uses it is suspect.
236236
*/
237-
private string $md5Ctxt; // @phpstan-ignore-line
237+
private string $md5Ctxt = '';
238238

239239
protected int $textObjRef;
240240

src/PhpSpreadsheet/ReferenceHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ private function updateNamedRange(DefinedName $definedName, Worksheet $worksheet
921921
{
922922
$cellAddress = $definedName->getValue();
923923
$asFormula = ($cellAddress[0] === '=');
924-
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $worksheet->getHashCode()) {
924+
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashInt() === $worksheet->getHashInt()) {
925925
/**
926926
* If we delete the entire range that is referenced by a Named Range, MS Excel sets the value to #REF!
927927
* PhpSpreadsheet still only does a basic adjustment, so the Named Range will still reference Cells.
@@ -940,7 +940,7 @@ private function updateNamedRange(DefinedName $definedName, Worksheet $worksheet
940940

941941
private function updateNamedFormula(DefinedName $definedName, Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns, int $numberOfRows): void
942942
{
943-
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $worksheet->getHashCode()) {
943+
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashInt() === $worksheet->getHashInt()) {
944944
/**
945945
* If we delete the entire range that is referenced by a Named Formula, MS Excel sets the value to #REF!
946946
* PhpSpreadsheet still only does a basic adjustment, so the Named Formula will still reference Cells.

0 commit comments

Comments
 (0)