Skip to content

Commit

Permalink
[BUGFIX] Guard nullable getNormalizedParams in getIpFunction
Browse files Browse the repository at this point in the history
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: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Nikita Hovratov <nikita.h@live.de>
  • Loading branch information
nhovratov committed Apr 18, 2024
1 parent a35c3a1 commit 2ce1939
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -67,7 +67,11 @@ static function ($arguments, $str) {
1686745105
);
}
return GeneralUtility::cmpIP($request->getNormalizedParams()->getRemoteAddress(), $str);
$normalizedParams = $request->getNormalizedParams();
if ($normalizedParams === null) {
return false;
}
return GeneralUtility::cmpIP($normalizedParams->getRemoteAddress(), $str);
}
);
}
Expand Down

0 comments on commit 2ce1939

Please sign in to comment.