EE version 2.10.1
I noticed this SQL error while trying to write some conditional code for the validation of the date declared thru segments.
While displaying the entries with exp:channel:entries with dynamic=”yes” parameter, the events I noticed;
For “month” case (YYYY could be a realistic year or any 4-digit number.):
www.example.com/site/news/YYYY/any-2-digit-number-greater-than-12
For “day” case (provided that MM is a 2-digit number from 01 to 12):
www.example.com/site/news/YYYY/MM/any-2-digit-number-greater-than-31
gives below SQL error:
Error Number: 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 ‘AND t.entry_date <= AND t.status = ‘open” at line 2
SELECT t.entry_id FROM exp_channel_titles AS t LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id WHERE t.entry_id !=” AND t.site_id IN (‘1’) AND t.entry_date < 1451611732 AND (t.expiration_date = 0 OR t.expiration_date > 1451611732) AND t.entry_date >= AND t.entry_date <= AND t.status = ‘open’
Filename: ………\system\codeigniter\system\database\DB_driver.php
Line Number: 382
Is this a bug? if yes; any quick fix?
To double check and verify my case above, I’ve tested www…/YYYY/13/ and www…./YYYY/MM/32 links on several EE based websites’ time based sections. I saw 500 server error instead of 404 page of the site although 404 is fired when there is no entry for valid date and/or day segments in the link.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.