Skip to content

Conversation

@aelkiss
Copy link
Member

@aelkiss aelkiss commented Jan 28, 2026

Commenting out the php_value stuff in .htaccess was the main thing that gets the errors out of the web page; ErrorDocument 404 plus the fixes in the PHP default error handler should handle the remaining 404 errors.

To test this:

  • try this branch on dev-N
  • add something that should cause a warning or an error in index.php
  • see that it doesn't show up in the output

With an error, we'll get an unstyled default 500 page. This is better than a messy PHP error; I couldn't get ErrorDocument to work here, and I'm not sure why, but I also don't know how much it really matters. We can certainly keep an eye out to see what kinds of things trigger 500 errors in production.

The fallthrough styled 404 also relies on ErrorDocument in .htaccess, so I don't have a good way to test that with playwright. We could test that e.g. "/foo/bar" gives a styled 404 with playwright, I suppose, if we want, since that's being handled by the application. Again, we can try it on dev-N with a variety of garbage URLs, all of which should give the 404 error page.

@carylwyatt feel free to apply styling as desired in interface/themes/firebird/Error/Error404.tpl (and perhaps Record/error.tpl and Search/error.tpl?)

We do not want php error output going to the user.
rewrite.php was removed in 64fd3d4 to
no apparent ill effect. The redirect there to mirlyn-classic won't have
worked for years, and the other rewrite there (with func=direct and a
doc_number parameter) may have served for very obsolete forms of URLs.
This may have been vestigial from when this code base was used for the
Michigan catalog.
* Don't display PHP error messages on the 404 page
* Use as ErrorDocument as well as as the default error handler in
  catalog


RewriteRule ^robots.txt$ static/robots.txt [L]
RewriteRule ^F static/rewrite.php [L]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on the commit - fc3f2a4

@aelkiss aelkiss changed the title ETT-1189: Disable PHP error reporting in production ETT-1189: Disable PHP error reporting in production; ETT-1140 show a styled 404 page Jan 28, 2026
@aelkiss
Copy link
Member Author

aelkiss commented Jan 28, 2026

Playwright indicates that the API paths are returning a 200 when they should return a 404. I'll look at that, and maybe just go ahead and add a playwright test for the default error path in the catalog.

@aelkiss aelkiss marked this pull request as draft January 28, 2026 20:29
@moseshll
Copy link
Contributor

@aelkiss the Bib API 404s in playwright seem to now be squeaking through index.php line 329. If I add header("HTTP/1.0 404 Not Found"); before the exit() then tests pass but it does seem hacquish.

$module = (isset($_GET['module'])) ? $_GET['module'] : 'error';

if ($module == 'api') {
exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be responsible for the Bib API 200s where there should be 404s.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should put a 404 and maybe JSON payload?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. I'll check what it was doing before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've restored the behavior it had before, which was a bare 404.

@aelkiss aelkiss marked this pull request as ready for review January 28, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants