diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php index c394c692b1c5bb8faa3cb702211af535ff49c7df..4dea6aba98601a4d5a4ed197af2e202476559717 100644 --- a/library/Class/Catalogue.php +++ b/library/Class/Catalogue.php @@ -151,7 +151,7 @@ class CatalogueLoader extends Storm_Model_Loader { if (!$docType = $catalogue->getTypeDoc()) return ''; - $parts = explode(';', $docType); + $parts = array_filter(explode(';', $docType)); if (1 == count($parts)) return 'type_doc=' . $parts[0]; diff --git a/tests/library/Class/CatalogueTest.php b/tests/library/Class/CatalogueTest.php index 80ed461c6ad238f7f6ef391836438a8bc3ba37a3..e0298cf399466f67539979d636c191fcb66dda6f 100644 --- a/tests/library/Class/CatalogueTest.php +++ b/tests/library/Class/CatalogueTest.php @@ -332,7 +332,7 @@ class CatalogueTestGetPagedNotices extends ModelTestCase { /** @test */ public function withSeveralTypeDocShouldQueryOnColumn() { - $this->_catalogue->setTypeDoc('7;10;12'); + $this->_catalogue->setTypeDoc('7;10;12;'); $this->_expectNoticeFindAllBy('type_doc IN (7, 10, 12)'); Class_Catalogue::getLoader()->loadNoticesFor($this->_catalogue); }