Skip to content
Snippets Groups Projects
Commit 2ce19397 authored by Nikita Hovratov's avatar Nikita Hovratov
Browse files

[BUGFIX] Guard nullable getNormalizedParams in getIpFunction

In case of CLI context, normalized params are not available and as they
are nullable, a guard condition is required before accessing methods.

Note: The access via request object was added in #100047 along with a
deprecation of using the ip() function in TSConfig. However, there is a
special case, where plain TypoScript is loaded even in CLI context. For
example this can happen when EXT:form listens to FlexForm data structure
parsing event. Then it needs information from TypoScript on how to
manipulate FlexForm based on YAML definitions.

Resolves: #103644
Related: #100047
Releases: main, 12.4
Change-Id: Id2d166fd11794db9b7a8102677e5b9305fe18c59
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83842


Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
parent a35c3a15
No related merge requests found
......@@ -67,7 +67,11 @@ class DefaultFunctionsProvider implements ExpressionFunctionProviderInterface
1686745105
);
}
return GeneralUtility::cmpIP($request->getNormalizedParams()->getRemoteAddress(), $str);
$normalizedParams = $request->getNormalizedParams();
if ($normalizedParams === null) {
return false;
}
return GeneralUtility::cmpIP($normalizedParams->getRemoteAddress(), $str);
}
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment