Bug #14267
closedsorting must be set for pi_list_query to work
0%
Description
In class.tslib_pibase.php the function pi_list_query() specifies "orderBy" as an optional param. However, it fails if no orderBy (can be empty) is set. This also affects pi_exec_query().
For example this code:
$this->pi_list_query("tx_some_table");
... generates non-vaild SQL like this:
" .... ORDER BY tx_some_table. LIMIT x,y"
(issue imported from #M280)
Updated by Ingmar Schlecht over 20 years ago
In the function tslib_pibase::pi_list_query() I suggest to change the following lines from:
// Order by data:
if (!$orderBy) {
if (t3lib_div::inList($this->internal['orderByList'],$this->internal['orderBy'])) {
$orderBy = 'ORDER BY '.$table.'.'.$this->internal['orderBy'].($this->internal['descFlag']?' DESC':'');
}
}
To:
// Order by data:
if (!$orderBy && $this->internal['orderBy']) {
if (t3lib_div::inList($this->internal['orderByList'],$this->internal['orderBy'])) {
$orderBy = 'ORDER BY '.$table.'.'.$this->internal['orderBy'].($this->internal['descFlag']?' DESC':'');
}
}
So the condition includes a check for $this->internal['orderBy'].
Updated by Ingmar Schlecht over 20 years ago
Cazoo, can you please verify that my fix works and does not cause any harm?
I would commit the fix to the CVS then.
Updated by old_cazoo over 20 years ago
I would if I could - my testplatform is currently under re-construction after a HD crash. I will test your fix when I'm and running, but it might take a while.
Updated by Ingmar Schlecht about 20 years ago
did you test it?
Otherwise it will not go into 3.7.