Skip to content

Commit

Permalink
Trigger deprecation warnings if the Symfony routing is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed May 8, 2020
1 parent a9f09bc commit 156ef52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core-bundle/src/Resources/contao/controllers/FrontendIndex.php
Expand Up @@ -180,6 +180,8 @@ public function renderPage($pageModel)

if (preg_match('#^' . $language . $objPage->id . '(' . $suffix . '($|\?)|/)#', Environment::get('relativeRequest')))
{
@trigger_error('Checking for duplicate URLs with ID/alias in FrontendIndex::renderPage() has been deprecated and will no longer work Contao 5.0. Use the Symfony routing instead.', E_USER_DEPRECATED);

throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
}
}
Expand Down Expand Up @@ -207,6 +209,8 @@ public function renderPage($pageModel)

if (!$hasItem)
{
@trigger_error('Checking for "requireItem" in FrontendIndex::renderPage() has been deprecated and will no longer work Contao 5.0. Use the Symfony routing instead.', E_USER_DEPRECATED);

throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
}
}
Expand All @@ -217,6 +221,8 @@ public function renderPage($pageModel)
// Trigger the 404 page if the page is not published and the front end preview is not active (see #374)
if (!BE_USER_LOGGED_IN && !$objPage->isPublic)
{
@trigger_error('Checking for published pages in FrontendIndex::renderPage() has been deprecated and will no longer work Contao 5.0. Use the Symfony routing instead.', E_USER_DEPRECATED);

throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
}

Expand All @@ -242,12 +248,16 @@ public function renderPage($pageModel)
// Do not try to load the 404 page, it can cause an infinite loop!
if (!BE_USER_LOGGED_IN && !$objPage->rootIsPublic)
{
@trigger_error('Checking for published root page in FrontendIndex::renderPage() has been deprecated and will no longer work Contao 5.0. Use the Symfony routing instead.', E_USER_DEPRECATED);

throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
}

// Check wether the language matches the root page language
if (isset($_GET['language']) && Config::get('addLanguageToUrl') && Input::get('language') != $objPage->rootLanguage)
{
@trigger_error('Checking for page language in FrontendIndex::renderPage() has been deprecated and will no longer work Contao 5.0. Use the Symfony routing instead.', E_USER_DEPRECATED);

throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
}

Expand Down

0 comments on commit 156ef52

Please sign in to comment.