PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
← All changes | app/Services/Renderer/CheckoutFieldsSchema.php +18 -4 1.5.5 → 1.6.5 View file →
@@ -10,9 +10,24 @@
10 10 use FluentCart\Framework\Support\Arr;
11 11
12 12 class CheckoutFieldsSchema
13 13 {
14 + /**
15 + * Per-request memo for getFieldsSettings(). In production every HTTP
16 + * request runs in a fresh PHP process, so this lives exactly one request.
17 + * Long-running processes that simulate multiple requests (test suites,
18 + * CLI) must clear it between simulated requests via
19 + * resetFieldsCache() — as a function-static it was
20 + * unreachable and leaked the first request's field settings into every
21 + * subsequent one.
22 + */
23 + private static $fieldsCache = null;
14 24
25 + public static function resetFieldsCache(): void
26 + {
27 + self::$fieldsCache = null;
28 + }
29 +
15 30 public static function titleMap(): array
16 31 {
17 32 return [
18 33 'full_name' => __('Name', 'fluent-cart'),
@@ -588,11 +603,10 @@
588 603 }
589 604
590 605 public static function getFieldsSettings()
591 606 {
592 - static $cached = null;
593 - if ($cached !== null) {
594 - return $cached;
607 + if (self::$fieldsCache !== null) {
608 + return self::$fieldsCache;
595 609 }
596 610
597 611 $defaults = [
598 612 'basic_info' => [
@@ -735,9 +749,9 @@
735 749
736 750 $defaults[$key] = wp_parse_args($savedValues, $default);
737 751 }
738 752
739 - return ($cached = $defaults);
753 + return (self::$fieldsCache = $defaults);
740 754 }
741 755
742 756 public static function isTermsRequired(): bool
743 757 {