[TYPO3-core] FYI #15396: Wrong query - crashes with DBAL

Xavier Perseguers typo3 at perseguers.ch
Thu Aug 12 18:37:41 CEST 2010


Hi François,

>> Problem:
>> Query in scheduler/mod1/index.php:927 is wrong, missing WHERE clause. If
>> extension is used with DBAL (for example on PostgreSQL), after switching
>> to Sheduler menu item in BE you can only see the following error:
>> "Could not parse where clause in
>> /usr/share/typo3/typo3/sysext/dbal/class.ux_t3lib_db.php : 1098'.
>>
>> Solution:
>> Add a 'true' WHERE clause to the query.
>
> I'm not sure I understand the issue here. Are you saying that DBAL can't
> handle an empty WHERE clause?

That's it! I agree that the phpDoc says it's optional but the method 
signature is clear:

function exec_SELECTquery($select_fields, $from_table, $where_clause, 
$groupBy = '', $orderBy = '', $limit = '') {

$where_clause is not optional. And when you use the "array" variant of 
exec_SELECT, all parameters are passed to exec_SELECTquery().

BTW, this is not DBAL-related, but Core-related and all methods in Core 
use the famous "1=1" somewhere in there query unless they have without 
"externally added conditions" a base set of conditions on the table.

Cheers
Xavier


More information about the TYPO3-team-core mailing list