diff --git a/lib/db.php b/lib/db.php index 951c21f414..3aff9cc68a 100644 --- a/lib/db.php +++ b/lib/db.php @@ -703,11 +703,11 @@ class DoctrineStatementWrapper { } private function tryFixSubstringLastArgumentDataForMSSQL($input) { - $query = $this->statement->queryString; + $query = $this->statement->getWrappedStatement()->queryString; $pos = stripos ($query, 'SUBSTRING'); if ( $pos === false) { - return; + return $input; } try {