4 users online. Create an account or sign in to join them.Users
A for , submitted by rainerborene on 12 August 2009
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
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.
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.
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)));
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
throw new FrontendPageNotFoundException;
Cool. Frontend404Exception sounds much better. However, great work!
This issue is closed.
Contact the team
Symphony • Open Source XSLT CMS