Project

General

Profile

Actions

Bug #23571

closed

dbal does not parse setDBinit correctly

Added by Tamer Erdogan about 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2010-09-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

class.ux_t3lib_db.php.diff (723 Bytes) class.ux_t3lib_db.php.diff Administrator Admin, 2010-09-20 13:44

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #21501: Install Tool duplicates values of textarea fieldsClosedSteffen Kamper2009-11-09

Actions
Actions #1

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.

Actions #2

Updated by Xavier Perseguers about 14 years ago

Committed to:

- trunk (rev. 38342)
- DBAL_1-1 (rev. 38343)

Actions

Also available in: Atom PDF