Announcement

Symphony's issue tracker has been moved to Github.

Issues are displayed here for reference only and cannot be created or edited.

Browse

Closed#109: Datasource redirection

Hi,

When you enter on a page that doesn’t exists it returns the 404 template. Ok, fine until now. But when you go to page that uses a datasource and when this entry doesn’t exists it redirects to 404 page. I think it should keep the same behaviour like the first situation.

Example

If you go to http://localhost/symphony/i-know-that-this-page-not-exists it returns the 404 template. I mean it not redirects. This is great.

If you go to http://localhost/symphony/my-page-that-uses-datasource/some-entry it’s redirecting to 404 page instead of load the 404 template.

Thanks.

Good call! I’ve noticed this before but never thought to raise as a bug.

See my commit.

I hope that helps. Thanks!

Nice one mate. Did you send a Pull Request to “symphony”? This will ensure Alistair/Allen sees this patch.

Reposting what I wrote in the commit made by rainerborene:


Your code is fine, but I dont actually like that the core DS code builds an error page at all. It should be making a call to a function in the FrontendPage or Frontend class, or even cooler is to throw a custom Exception. E.G.

throw new Frontend404Exception

and have a Frontend404Exception handler do the work. That way, any front-end page/code from anywhere can invoke an error page. The code for custom exception handlers is already in the integration branch, so it shouldn’t require much work. Might have a look at it this week.

I should add, there is no technical reason you shouldn’t use your code as a stop-gap solution if you need to. That is probably how it should have behaved anyway. The only advice I can give is to maybe tweak it slightly:

$output = Frontend::instance()->display($url);
header(sprintf('Content-Length: %d', strlen($output)));
echo $output;
exit;

But it’s not that necessary.

Added a ‘FrontendPageNotFoundException’ class. This is a replacement for explicitly redirecting to a 404 page and solves the problem raised by issue #109. ‘Datasource::__redirectToErrorPage()’ will be removed in a later version in favour of throwing a ‘FrontendPageNotFoundException’ exception. Closed by 2d5fb8918b521eb5c2874b10046c84819f7a5a34

Use throw new FrontendPageNotFoundException; anywhere to trigger a 404 page. Is that cool or what? :D

Cool. Frontend404Exception sounds much better. However, great work!

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details