После обновления веб окружения Bitrix c PHP Version 5.1.6 и mySQL Client API version 5.0.22 до PHP Version 5.3.3 и mySQL Client API version 5.1.61 корзина перестала работать. Появилась ошибка "DB query error. Please try later.".

Если попытаться войти в корзину с правами администратора сайта, Bitrix выдает более подробную информацию об ошибке:

File: /home/bitrix/www/bitrix/modules/sale/mysql/discount.php
Line: 142 MySQL Query Error: SELECT DISTINCT D.ID as ID, D.LID as LID, D.LID as SITE_ID, D.PRICE_FROM as PRICE_FROM, D.PRICE_TO as PRICE_TO, D.CURRENCY as CURRENCY, D.DISCOUNT_VALUE as DISCOUNT_VALUE, D.DISCOUNT_TYPE as DISCOUNT_TYPE, D.ACTIVE as ACTIVE, D.SORT as SORT, DATE_FORMAT(D.ACTIVE_FROM, '%d.%m.%Y %H:%i:%s') as ACTIVE_FROM, DATE_FORMAT(D.ACTIVE_TO, '%d.%m.%Y %H:%i:%s') as ACTIVE_TO FROM b_sale_discount D WHERE ((((D.LID = 's1' )))) AND ((((D.ACTIVE = 'Y' )))) AND ((( D.ACTIVE_FROM IS NULL OR NOT (D.ACTIVE_FROM > '2013-04-25 10:34:51')))) AND ((( D.ACTIVE_TO IS NULL OR NOT (D.ACTIVE_TO < '2013-04-25 10:34:51')))) AND ((())) AND ((())) ORDER BY D.SORT ASC [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 ((())) ORDER BY D.SORT ASC' at line 1]

Ошибку можно исправить изменив строку параметров в определении функции PrepareSql файл /home/bitrix/www/bitrix/modules/sale/general/order.php

//	http://integrator.adior.ru/ : появилась ошибка при переходе с PHP Version 5.1.6 на PHP Version 5.3.3
//	MySQL Query Error: SELECT DISTINCT D.ID as ID, D.LID as LID, D.LID as SITE_ID, D.PRICE_FROM as PRICE_FROM, D.PRICE_TO as PRICE_TO, D.CURRENCY as CURRENCY, D.DISCOUNT_VALUE as DISCOUNT_VALUE, D.DISCOUNT_TYPE as DISCOUNT_TYPE, D.ACTIVE as ACTIVE, D.SORT as SORT, DATE_FORMAT(D.ACTIVE_FROM, '%d.%m.%Y %H:%i:%s') as ACTIVE_FROM, DATE_FORMAT(D.ACTIVE_TO, '%d.%m.%Y %H:%i:%s') as ACTIVE_TO FROM b_sale_discount D WHERE ((((D.LID = 's1' )))) AND ((((D.ACTIVE = 'Y' )))) AND ((( D.ACTIVE_FROM IS NULL OR NOT (D.ACTIVE_FROM > '2013-04-25 10:34:51')))) AND ((( D.ACTIVE_TO IS NULL OR NOT (D.ACTIVE_TO < '2013-04-25 10:34:51')))) AND ((())) AND ((())) ORDER BY D.SORT ASC [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 ((())) ORDER BY D.SORT ASC' at line 1]
//	function PrepareSql(&$arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields)
	function PrepareSql(&$arFields, $arOrder, &$arFilter, $arGroupBy, $arSelectFields)