@@ -53,10 +53,12 @@ public static function push(): void
5353 $ state ['globals-tca ' ] = $ GLOBALS ['TCA ' ];
5454 $ state ['request ' ] = $ GLOBALS ['TYPO3_REQUEST ' ] ?? null ;
5555
56- // Can be dropped when GeneralUtility::getIndpEnv() is abandoned
57- $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
58- $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
59- $ state ['generalUtilityIndpEnvCache ' ] = $ generalUtilityIndpEnvCache ->getValue ();
56+ // @todo: Remove when v14 compat is dropped, the property no longer exists in v15.
57+ if (property_exists (GeneralUtility::class, 'indpEnvCache ' )) {
58+ $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
59+ $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
60+ $ state ['generalUtilityIndpEnvCache ' ] = $ generalUtilityIndpEnvCache ->getValue ();
61+ }
6062
6163 $ state ['generalUtilitySingletonInstances ' ] = GeneralUtility::getSingletonInstances ();
6264
@@ -71,9 +73,12 @@ public static function reset(): void
7173 unset($ GLOBALS ['BE_USER ' ]);
7274 unset($ GLOBALS ['TYPO3_REQUEST ' ]);
7375
74- $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
75- $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
76- $ generalUtilityIndpEnvCache ->setValue (null , []);
76+ // @todo: Remove when v14 compat is dropped, the property no longer exists in v15.
77+ if (property_exists (GeneralUtility::class, 'indpEnvCache ' )) {
78+ $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
79+ $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
80+ $ generalUtilityIndpEnvCache ->setValue (null , []);
81+ }
7782
7883 GeneralUtility::resetSingletonInstances ([]);
7984 }
@@ -96,9 +101,12 @@ public static function pop(): void
96101 $ GLOBALS ['TCA ' ] = $ state ['globals-tca ' ];
97102 $ GLOBALS ['TYPO3_REQUEST ' ] = $ state ['request ' ];
98103
99- $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
100- $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
101- $ generalUtilityIndpEnvCache ->setValue (null , $ state ['generalUtilityIndpEnvCache ' ]);
104+ // @todo: Remove when v14 compat is dropped, the property no longer exists in v15.
105+ if (array_key_exists ('generalUtilityIndpEnvCache ' , $ state )) {
106+ $ generalUtilityReflection = new \ReflectionClass (GeneralUtility::class);
107+ $ generalUtilityIndpEnvCache = $ generalUtilityReflection ->getProperty ('indpEnvCache ' );
108+ $ generalUtilityIndpEnvCache ->setValue (null , $ state ['generalUtilityIndpEnvCache ' ]);
109+ }
102110
103111 GeneralUtility::resetSingletonInstances ($ state ['generalUtilitySingletonInstances ' ]);
104112 }
0 commit comments