From 5f383ca7cbf64cc5d593527b7f81ab9b2545716f Mon Sep 17 00:00:00 2001 From: Skip Potter Date: Wed, 29 Nov 2023 10:04:52 -0500 Subject: [PATCH] Update Core.php Variable $unstablePeriod is not initialized to the correct size producing the error "Message: Uncaught ErrorException: Undefined array key 22 in /root/vendor/lupecode/php-trader-native/source/TALib/Core/OverlapStudies.php:1657". --- source/TALib/Core/Core.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/TALib/Core/Core.php b/source/TALib/Core/Core.php index bf91f46..ac36b26 100644 --- a/source/TALib/Core/Core.php +++ b/source/TALib/Core/Core.php @@ -96,7 +96,9 @@ public static function construct(): void /* when measuring distance between parts of candles or width of gaps "equal" means "<= 5% of the average of the 5 previous candles' high-low range" */ new CandleSetting(CandleSettingType::Equal, RangeType::HighLow, 5, 0.05), ]; - static::$unstablePeriod = \array_pad([], UnstablePeriodFunctionID::ALL - 2, 0); + // Changed to correct array size to avoid the "Uncaught ErrorException: Undefined array key 22" + // static::$unstablePeriod = \array_pad([], UnstablePeriodFunctionID::ALL - 2, 0); + static::$unstablePeriod = \array_pad([], UnstablePeriodFunctionID::ALL, 0); } public static function setUnstablePeriod(int $functionID, int $unstablePeriod): void