* 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.