Skip to content

Commit ee2f787

Browse files
authored
[TASK] Assign DataHandler's property copyTree only if the property exists (#689)
1 parent 3ca70ed commit ee2f787

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Build/phpstan/phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ parameters:
2424
count: 1
2525
path: ../../Classes/Core/Functional/Framework/Constraint/RequestSection/HasRecordConstraint.php
2626

27+
-
28+
message: '#^Call to function property_exists\(\) with TYPO3\\CMS\\Core\\DataHandling\\DataHandler and ''copyTree'' will always evaluate to true\.$#'
29+
identifier: function.alreadyNarrowedType
30+
count: 1
31+
path: ../../Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php
32+
2733
-
2834
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
2935
identifier: staticMethod.alreadyNarrowedType

Classes/Core/Functional/Framework/DataHandling/ActionService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ protected function createDataHandler(): DataHandler
559559
{
560560
$this->dataHandler = GeneralUtility::makeInstance(DataHandler::class);
561561
$backendUser = $this->getBackendUser();
562-
if (isset($backendUser->uc['copyLevels'])) {
562+
if (isset($backendUser->uc['copyLevels']) && property_exists($this->dataHandler, 'copyTree')) {
563563
$this->dataHandler->copyTree = $backendUser->uc['copyLevels'];
564564
}
565565
return $this->dataHandler;

Classes/Core/Functional/Framework/DataHandling/Scenario/DataHandlerWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final public function __construct(
3333
public static function withBackendUser(BackendUserAuthentication $backendUser): self
3434
{
3535
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
36-
if (isset($backendUser->uc['copyLevels'])) {
36+
if (isset($backendUser->uc['copyLevels']) && property_exists($dataHandler, 'copyTree')) {
3737
$dataHandler->copyTree = $backendUser->uc['copyLevels'];
3838
}
3939
return new static($dataHandler, $backendUser);

0 commit comments

Comments
 (0)