Author: cnit
Description:
My extension has the following PHP code:
function getIntervalResults( $offset, $limit ) {
$result = array(); $db = & wfGetDB( DB_SLAVE ); $qp_users = $db->tableName( 'qp_users' ); $qp_users_polls = $db->tableName( 'qp_users_polls' ); $res = $db->select( "$qp_users_polls qup, $qp_users qu", array( 'qu.uid as uid', 'name as username', 'count(pid) as pidcount' ), 'qu.uid=qup.uid', __METHOD__, array( 'GROUP BY' => 'qup.uid', 'ORDER BY' => $this->order_by, 'OFFSET' => intval( $offset ), 'LIMIT' => intval( $limit ) ) ); while ( $row = $db->fetchObject( $res ) ) { $result[] = $row; } return $result;
}
It used to work with 1.15, works with 1.17 (right now), however with current trunk it produces the following broken query (copypasted from log):
SELECT /* qp_UsersList::getIntervalResults QuestPC */ qu.uid as uid,name as username,count(pid) as pidcount FROM wiki_wiki_qp_users_polls` qup, wiki_qp_users qu` WHERE qu.uid=qup.uid GROUP BY qup.uid ORDER BY count(pid) DESC, name ASC LIMIT 50
As you probably see, the FROM arguments are corrupted:
FROM wiki_wiki_qp_users_polls` qup, wiki_qp_users qu`
especially wiki_wiki_qp_users_polls`
which causes:
(SQL запрос скрыт)
произошёл из функции «qp_UsersList::getIntervalResults». База данных возвратила ошибку «1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' qup, wiki_qp_users` qu` WHERE qu.uid=qup.uid GROUP BY qup.uid ORDER BY coun' at line 1 (127.0.0.1)».
Version: 1.20.x
Severity: normal