Skip to content

Commit a0f811f

Browse files
authored
Merge branch 'master' into amordegrc
2 parents a25775a + 6c9b2a8 commit a0f811f

File tree

16 files changed

+245
-190
lines changed

16 files changed

+245
-190
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2525

2626
- Nothing yet.
2727

28+
### Removed
29+
30+
- The following items were deprecated in release 2 and are now removed.
31+
- Writer\Xls\Style\ColorMap (no longer needed).
32+
- Reader\Xml::trySimpleXMLLoadString (should not have been public, no public replacement).
33+
- Calculation\Calculation::_translateFormulaToLocale (use method name translateFormulaToLocale without leading underscore).
34+
- Calculation\Calculation::_translateFormulaToEnglish (use method name translateFormulaToEnglish without leading underscore).
35+
2836
### Moved
2937

3038
- Nothing yet.
@@ -33,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
3341

3442
- Xls Reader Some Ranges Not Handled Properly. [Issue #1570](https://github.com/PHPOffice/PhpSpreadsheet/issues/1570) [PR #4140](https://github.com/PHPOffice/PhpSpreadsheet/pull/4140)
3543
- Better Handling of legacyDrawing Xml. [Issue #4105](https://github.com/PHPOffice/PhpSpreadsheet/issues/4105) [PR #4122](https://github.com/PHPOffice/PhpSpreadsheet/pull/4122)
44+
- Improve Xlsx Reader Speed. [Issue #3917](https://github.com/PHPOffice/PhpSpreadsheet/issues/3917) [PR #4153](https://github.com/PHPOffice/PhpSpreadsheet/pull/4153)
3645

3746
## 2024-08-07 - 2.2.2
3847

composer.lock

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

samples/Basic4/45_Quadratic_equation_solver.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
?>
1616
<form action="45_Quadratic_equation_solver.php" method="POST">
17-
Enter the coefficients for the Ax<sup>2</sup> + Bx + C = 0
17+
Enter the coefficients for Ax<sup>2</sup> + Bx + C = 0
1818
<table border="0" cellpadding="0" cellspacing="0">
1919
<tr>
2020
<td>
@@ -47,7 +47,9 @@
4747
<?php
4848
/** If the user has submitted the form, then we need to execute a calculation * */
4949
if (isset($_POST['submit'])) {
50-
if ($_POST['A'] == 0) {
50+
if (!is_numeric($_POST['A']) || !is_numeric($_POST['B']) || !is_numeric($_POST['C'])) { // validate input
51+
$helper->log('Non-numeric input');
52+
} elseif ($_POST['A'] == 0) {
5153
$helper->log('The equation is not quadratic');
5254
} else {
5355
// Calculate and Display the results

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,16 +3318,6 @@ private static function translateFormula(array $from, array $to, string $formula
33183318

33193319
private static ?array $functionReplaceToLocale;
33203320

3321-
/**
3322-
* @deprecated 1.30.0 use translateFormulaToLocale() instead
3323-
*
3324-
* @codeCoverageIgnore
3325-
*/
3326-
public function _translateFormulaToLocale(string $formula): string
3327-
{
3328-
return $this->translateFormulaToLocale($formula);
3329-
}
3330-
33313321
public function translateFormulaToLocale(string $formula): string
33323322
{
33333323
$formula = preg_replace(self::CALCULATION_REGEXP_STRIP_XLFN_XLWS, '', $formula) ?? '';
@@ -3365,16 +3355,6 @@ public function translateFormulaToLocale(string $formula): string
33653355

33663356
private static ?array $functionReplaceToExcel;
33673357

3368-
/**
3369-
* @deprecated 1.30.0 use translateFormulaToEnglish() instead
3370-
*
3371-
* @codeCoverageIgnore
3372-
*/
3373-
public function _translateFormulaToEnglish(string $formula): string
3374-
{
3375-
return $this->translateFormulaToEnglish($formula);
3376-
}
3377-
33783358
public function translateFormulaToEnglish(string $formula): string
33793359
{
33803360
if (self::$functionReplaceFromLocale === null) {

src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ private static function vLookupSearch(mixed $lookupValue, array $lookupArray, $c
8888

8989
$rowNumber = null;
9090
foreach ($lookupArray as $rowKey => $rowData) {
91-
$bothNumeric = is_numeric($lookupValue) && is_numeric($rowData[$column]);
92-
$bothNotNumeric = !is_numeric($lookupValue) && !is_numeric($rowData[$column]);
91+
$bothNumeric = self::numeric($lookupValue) && self::numeric($rowData[$column]);
92+
$bothNotNumeric = !self::numeric($lookupValue) && !self::numeric($rowData[$column]);
9393
$cellDataLower = StringHelper::strToLower((string) $rowData[$column]);
9494

9595
// break if we have passed possible keys
@@ -114,4 +114,9 @@ private static function vLookupSearch(mixed $lookupValue, array $lookupArray, $c
114114

115115
return $rowNumber;
116116
}
117+
118+
private static function numeric(mixed $value): bool
119+
{
120+
return is_int($value) || is_float($value);
121+
}
117122
}

src/PhpSpreadsheet/Cell/Cell.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,21 @@ public function setValueExplicit(mixed $value, string $dataType = DataType::TYPE
318318
$this->updateInCollection();
319319
$cellCoordinate = $this->getCoordinate();
320320
self::updateIfCellIsTableHeader($this->getParent()?->getParent(), $this, $oldValue, $value);
321-
$this->getWorksheet()->applyStylesFromArray($cellCoordinate, ['quotePrefix' => $quotePrefix]);
321+
$worksheet = $this->getWorksheet();
322+
$spreadsheet = $worksheet->getParent();
323+
if (isset($spreadsheet)) {
324+
$originalSelected = $worksheet->getSelectedCells();
325+
$activeSheetIndex = $spreadsheet->getActiveSheetIndex();
326+
$style = $this->getStyle();
327+
$oldQuotePrefix = $style->getQuotePrefix();
328+
if ($oldQuotePrefix !== $quotePrefix) {
329+
$style->setQuotePrefix($quotePrefix);
330+
}
331+
$worksheet->setSelectedCells($originalSelected);
332+
if ($activeSheetIndex >= 0) {
333+
$spreadsheet->setActiveSheetIndex($activeSheetIndex);
334+
}
335+
}
322336

323337
return $this->getParent()?->get($cellCoordinate) ?? $this;
324338
}

0 commit comments

Comments
 (0)