ZF-4251: Zend_Db_Adapter_Pdo_Mssql doeas not support both LIMIT and DISTINCT in the same query
MsSql does not support OFFSET parameter for LIMIT. Zend_Db_Adapter_Pdo_Mssql implements a workaround by using the original query as a subquery, so it prepends and appends the required code to the original query. Zend_Db_Adapter_Pdo_Mssql->limit method not takes care of the DISTINCT clause, so generates ... (SELECT TOP xx DISTINCT ... like query, but the correct syntax would be ...( SELECT DISTINCT TOP xx ...
Possible correction use '/^SELECT\s+(DISTINCT\s+)?/i' regular expression insead of '/^SELECT\s/i'