Skip to content

[fix?] forum: Show posts action result ina db error by anonymous user

romoxi requested to merge romoxi/tiki:master into master

DB-Error tiki-logs come up, when a anonymous user try to filter the forum posts.

Show posts: All, Last hour, Last 24 hours, Last 48 hours.

Column 'commentDate' in where clause is ambiguous -

select tc1.`threadId`, tc1.`object`, tc1.`objectType`, tc1.`parentId`, tc1.`userName`, tc1.`commentDate`, tc1.`hits`, tc1.`type`, tc1.`points`, tc1.`votes`, tc1.`average`, tc1.`title`, tc1.`data`, tc1.`hash`, tc1.`summary`, tc1.`smiley`, tc1.`message_id`, tc1.`in_reply_to`, tc1.`comment_rating`, tc1.`approved`, tc1.`locked`  from `tiki_comments` as tc1
				left outer join `tiki_comments` as tc2 on tc1.`in_reply_to` = tc2.`message_id`
				and tc1.`parentId` = '15'
				and tc2.`parentId` = '15'
				
				 where tc1.`objectType` = 'forum' and tc1.`object`='2' and tc1.`parentId`='15' and tc1.`average`>='0'  and tc1.`approved`='y'
				and (tc1.`in_reply_to` = 'robert@www.maschinfo.de'
						or (tc2.`in_reply_to` = '' or tc2.`in_reply_to` is null or tc2.`message_id` is null or tc2.`parentId` = 0))
				 and `commentDate` > '1613486171'  order by `commentDate` asc, tc1.`threadId`

I'm not sure, if the changes are really correct. Maybe the it should be the alias table "tc2" insted of "tc1"??? However in my installation it works fine.

Edited by Fabio Montefuscolo

Merge request reports