Page MenuHomePhabricator

Avoid fatal PHP errors when IBAN validation fails
Open, Needs TriagePublic


When the user manages to send an invalid IBAN to the server as part of creating a donation, the controller can't render the error message, because it makes the assumption that the values it gets are strings. The IBAN, however, is an IBAN class.

Error message:

Recoverable fatal error: Object of class WMDE\Fundraising\PaymentContext\Domain\Model\Iban could not be converted to string in /usr/share/nginx/www/ on line 252

This error has low priority because this can only happen when the client-side validation fails. But it points at a possible architecture violation (using a domain object in the presentation layer).

Event Timeline

Restricted Application added a project: WMDE-FUN-Team. · View Herald TranscriptNov 21 2018, 12:21 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

The php error itself could be solved by simply adding a __toString() method to the IBAN class.