Commit 8bfcf683 authored by Rob Bayliss's avatar Rob Bayliss Committed by Marco Pivetta

Fix unique index exception handling for an index on multiple columns in PHP 5.4

parent 4067c725
...@@ -42,6 +42,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver ...@@ -42,6 +42,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
{ {
if (strpos($exception->getMessage(), 'must be unique') !== false || if (strpos($exception->getMessage(), 'must be unique') !== false ||
strpos($exception->getMessage(), 'is not unique') !== false || strpos($exception->getMessage(), 'is not unique') !== false ||
strpos($exception->getMessage(), 'are not unique') !== false ||
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false
) { ) {
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
......
...@@ -71,6 +71,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest ...@@ -71,6 +71,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest
self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => array( self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => array(
array(null, null, 'must be unique'), array(null, null, 'must be unique'),
array(null, null, 'is not unique'), array(null, null, 'is not unique'),
array(null, null, 'are not unique'),
), ),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment