Bug #23571
closeddbal does not parse setDBinit correctly
0%
Description
I have Typo3 4.4.2 and dbal 1.1.7. In my localconf.php there is the following configuration:
$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;\' . LF . \'SET SESSION character_set_server=utf8;'; // Modified or inserted by TYPO3 Install Tool.
This configuration is from Installation Tool. I think Typo3 writes this false. In my view it should be like this:
$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;' . LF . 'SET SESSION character_set_server=utf8;'; // Modified or inserted by TYPO3 Install Tool.
If I change this as above, then the dbal run the setDBinit correctly. But in first version it does not run it.
In t3lib/class.t3lib_db.php, this configuration is parsed as following:
$setDBinit = t3lib_div::trimExplode(LF, str_replace("' . LF . '", LF, $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit']), TRUE);
In typo3/sysext/dbal/class.ux_t3lib_db.php, like this:
$setDBinit = t3lib_div::trimExplode(chr(10), $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'], 1);
Of course, this would not give the desired array. Therefore setDBinit will not be run.
There are two possible solutions:
1) Installation tool should write the setDBinit correctly as following:
$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;' . LF . 'SET SESSION character_set_server=utf8;'; // Modified or inserted by TYPO3 Install Tool.
And in typo3/sysext/dbal/class.ux_t3lib_db.php, the following change should be done:
$setDBinit = t3lib_div::trimExplode(LF, $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'], 1);
2) In typo3/sysext/dbal/class.ux_t3lib_db.php, the setDBinit should be parsed like in t3lib/class.t3lib_db.php:
$setDBinit = t3lib_div::trimExplode(LF, str_replace("' . LF . '", LF, $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit']), TRUE);
In patch file I have uploaded the 2. solution. I would rather have the first solution be done.
(issue imported from #M15751)
Files
Updated by Chris topher about 14 years ago
To write the values to localconf that way was introduced with #12514. See the discussion on Core List for further information.
Seems like adopting dbal has been forgotten.
Updated by Xavier Perseguers about 14 years ago
Committed to:
- trunk (rev. 38342)
- DBAL_1-1 (rev. 38343)