Issue Bug Closed

#60998PageRepository::shouldFieldBeOverlaid raises PHP warning

Stefan Rotsch 08/15/14, 16:10 updated 10/02/18, 11:52

Description

With TYPO3 6.2.4, the sys_log shows a lot of PHP warnings:

Core: Error handler (FE): PHP Warning: trim() expects parameter 1 to be string, array given in [...]/typo3/sysext/frontend/Classes/Page/PageRepository.php line 1416

When looking at the shouldFieldBeOverlaid method, the PHPDoc comment states the type of $value being “mixed”:

1396:      * @param mixed $value Current value of the field

$value is assigned to $checkValue later:

1409:    $checkValue = $value;

Then the critical trim() is executed without verifying the type of $checkValue:

1416:    if (trim($checkValue) === '') {
1417:        $shouldFieldBeOverlaid = FALSE;
1418:    }

At some point there should be a type check against $checkValue instead of assuming it to be a string.

Reviews 4