Commit Graph
7 Commits
Author SHA1 Message Date
Adam Daley 7d7d824acd Drop Sentry issue ID from Twig cache failure test name 2026-09-19 13:38:37 +01:00
Adam Daley fb55576fe2 Drop Sentry issue IDs from regression test names 2026-09-19 13:35:03 +01:00
Adam Daley 957cace2c8 Move Sentry regression tests into their module test files 2026-09-19 13:34:31 +01:00
Adam Daley 2e953b0bf0 Fix two PHP warnings surfaced by Sentry on 0.8-next (#4276)
* Fix two PHP warnings surfaced by Sentry on 0.8-next

- DomainPricingRepository::getActivePricingByTld() read $tld['periods']
  directly, which triggers an "Undefined array key" warning on any install
  whose tld table hasn't yet picked up the periods column added by #4115's
  schema patch. Switched to empty().

- ServiceInvoiceItem::getTax() multiplied $item->price without casting it;
  RedBean can hand back an empty string for an unset float column, which
  triggers a "non-numeric value" warning. Cast to float first.

Fixes FOSSBILLING-PK4
Fixes FOSSBILLING-J83

* Stop Twig cache-directory write failures from flooding Sentry

Twig's FilesystemCache throws a raw \RuntimeException when it can't
create or write to the configured template cache directory (data/cache),
which happens whenever a host's file permissions are wrong. That
exception was completely uncaught, so every affected visitor got a raw
500 and every occurrence was reported to Sentry as a code bug even
though it's a host misconfiguration we can't fix from within the app
(~60k events across 4 duplicate-shaped Sentry issues:
FOSSBILLING-EBW/J8N/EWG/EWV).

Box_App::convertCacheWriteFailure() now catches it in both
Box_AppClient::render() and Box_AppAdmin::render(), converts it into a
FOSSBilling\Exception with a new Cache-category error code (5002), and
rethrows anything else unchanged. ErrorPage marks 5002 report:false
(this branch didn't have the Cache category yet, so it's added here
too), so Sentry stops seeing it while the visitor still gets a proper
error page.

* Handle all three Twig cache-write failure messages, not just one

Same gap CodeRabbit flagged on the main PR (#4277): Twig's
FilesystemCache::write() throws three different \RuntimeException
messages for the same underlying problem (missing/unwritable
data/cache directory), and convertCacheWriteFailure() only matched
one of them. Match all three, with a regression case for each.

* Don't imply file permissions are the only cause of a cache write failure

CodeRabbit review on #4276: 'Failed to write cache file' can also come
from a full disk, a hit quota, or a read-only mount, not just a
permissions problem - the error message told the admin to check
permissions when that might not be the actual cause. Broadened the
wording to also point at disk space.
2026-09-04 09:57:21 +01:00
Adam Daley 59fae43df5 Fix client sessions, form fields, and error pages (#4011)
* Fix client sessions, form fields, and error pages

* Redirect authenticated clients away from login
2026-07-17 20:03:05 +01:00
Adam Daley 85cd7aac2a Modernize HTTP response flow (#3928)
* Modernize HTTP response flow

* Fix route matcher test spelling
2026-07-07 05:15:39 +01:00
Adam Daley 1efffee98b Handle Twig render failures as 500 errors (#3874)
* Handle Twig render failures as 500 errors

* Fix nested Twig loader error handling

* Fix AppClient missing page test stub
2026-07-02 11:48:08 +01:00