Actions
Bug #104962
openTypeError in xml2array if flexform is NULL
Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2024-09-13
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
flexform
Complexity:
Is Regression:
Sprint Focus:
Description
If no flexform value has been entered, then it is stored as NULL in the database table.
This however leads to a TypeError in PHP 8.3.11.
(1/1) TypeError TYPO3\CMS\Core\Utility\GeneralUtility::xml2array(): Argument #1 ($string) must be of type string, null given, called in /path/typo3_src-13.2.1.test/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaFlexPrepare.php on line 104
in /path/typo3_src-13.2.1.test/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 1265
- @return array|string If the parsing had errors, a string with the error message is returned. Otherwise an array with the content.
* @see array2xml()
* @see xml2arrayProcess()
*/
public static function xml2array(string $string, string $NSprefix = '', bool $reportDocTag = false): array|string
{
$runtimeCache = static::makeInstance(CacheManager::class)->getCache('runtime');
$firstLevelCache = $runtimeCache->get('generalUtilityXml2Array') ?: [];
$identifier = md5($string . $NSprefix . ($reportDocTag ? '1' : '0'));
at TYPO3\CMS\Core\Utility\GeneralUtility::xml2array(null)
in /path/typo3_src-13.2.1.test/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaFlexPrepare.php line 104
if (isset($result['databaseRow'][$fieldName])) {
$valueArray = $result['databaseRow'][$fieldName];
}
if (!is_array($result['databaseRow'][$fieldName])) {
$valueArray = GeneralUtility::xml2array($result['databaseRow'][$fieldName]);
}
if (!is_array($valueArray)) {
$valueArray = [];
}
Actions