PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.5
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.5
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php +19 -6 3.1.33.4.5 View file →
@@ -116,9 +116,9 @@
116 116
117 117 /**
118 118 * An array of the nested cell references accessed by the calculation engine, used for the debug log.
119 119 *
120 - * @var array of string
120 + * @var CyclicReferenceStack
121 121 */
122 122 private $cyclicReferenceStack;
123 123
124 124 private $cellStack = [];
@@ -1944,8 +1944,13 @@
1944 1944 'category' => Category::CATEGORY_MATH_AND_TRIG,
1945 1945 'functionCall' => [MathTrig::class, 'SUMXMY2'],
1946 1946 'argumentCount' => '2',
1947 1947 ],
1948 + 'SWITCH' => [
1949 + 'category' => Category::CATEGORY_LOGICAL,
1950 + 'functionCall' => [Logical::class, 'statementSwitch'],
1951 + 'argumentCount' => '3+',
1952 + ],
1948 1953 'SYD' => [
1949 1954 'category' => Category::CATEGORY_FINANCIAL,
1950 1955 'functionCall' => [Financial::class, 'SYD'],
1951 1956 'argumentCount' => '4',
@@ -2206,10 +2211,10 @@
2206 2211
2207 2212 private static function loadLocales()
2208 2213 {
2209 2214 $localeFileDirectory = __DIR__ . '/locale/';
2210 - foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) {
2211 - $filename = substr($filename, strlen($localeFileDirectory) + 1);
2215 + foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) {
2216 + $filename = substr($filename, strlen($localeFileDirectory));
2212 2217 if ($filename != 'en') {
2213 2218 self::$validLocaleLanguages[] = $filename;
2214 2219 }
2215 2220 }
@@ -2412,9 +2417,8 @@
2412 2417 $language = $locale = strtolower($locale);
2413 2418 if (strpos($locale, '_') !== false) {
2414 2419 list($language) = explode('_', $locale);
2415 2420 }
2416 -
2417 2421 if (count(self::$validLocaleLanguages) == 1) {
2418 2422 self::loadLocales();
2419 2423 }
2420 2424 // Test whether we have any language data for this language (any locale)
@@ -2703,9 +2707,9 @@
2703 2707 *
2704 2708 * @param Cell $pCell Cell to calculate
2705 2709 * @param bool $resetLog Flag indicating whether the debug log should be reset or not
2706 2710 *
2707 - * @throws Exception
2711 + * @throws \PhpOffice\PhpSpreadsheet\Exception
2708 2712 *
2709 2713 * @return mixed
2710 2714 */
2711 2715 public function calculateCellValue(Cell $pCell = null, $resetLog = true)
@@ -2807,9 +2811,9 @@
2807 2811 * @param string $formula Formula to parse
2808 2812 * @param string $cellID Address of the cell to calculate
2809 2813 * @param Cell $pCell Cell to calculate
2810 2814 *
2811 - * @throws Exception
2815 + * @throws \PhpOffice\PhpSpreadsheet\Exception
2812 2816 *
2813 2817 * @return mixed
2814 2818 */
2815 2819 public function calculateFormula($formula, $cellID = null, Cell $pCell = null)
@@ -2890,8 +2894,17 @@
2890 2894 */
2891 2895 public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null)
2892 2896 {
2893 2897 $cellValue = null;
2898 +
2899 + // Quote-Prefixed cell values cannot be formulae, but are treated as strings
2900 + if ($pCell !== null && $pCell->getStyle()->getQuotePrefix() === true) {
2901 + return self::wrapResult((string) $formula);
2902 + }
2903 +
2904 + if (preg_match('/^=\s*cmd\s*\|/miu', $formula) !== 0) {
2905 + return self::wrapResult($formula);
2906 + }
2894 2907
2895 2908 // Basic validation that this is indeed a formula
2896 2909 // We simply return the cell value if not
2897 2910 $formula = trim($formula);