Saturday, April 8. 2017
And then I saw the Password in the Stack Trace
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
I would suggest:
- never use display_errors in production. Even when harmless, it's a broken behaviour to the user and actually it is. A full error message "Sorry something went wrong" is better than some cryptic code in the page
- Remove passwords from your code and read them from files. Then a trace with code will not contain the password (one with variable contents still may contain it). Plus: They are easier to change everywhere in the project at once
- Consider to use a template system instead of php direct for rendering the page
- Use a error logging tool like sentry to send the errors to something managed instead of user/logfile/email. Sentry has a nice display of the message and the code around it, collects several same error in the same issue and you can mark them as resolved or regression.
- never use display_errors in production. Even when harmless, it's a broken behaviour to the user and actually it is. A full error message "Sorry something went wrong" is better than some cryptic code in the page
- Remove passwords from your code and read them from files. Then a trace with code will not contain the password (one with variable contents still may contain it). Plus: They are easier to change everywhere in the project at once
- Consider to use a template system instead of php direct for rendering the page
- Use a error logging tool like sentry to send the errors to something managed instead of user/logfile/email. Sentry has a nice display of the message and the code around it, collects several same error in the same issue and you can mark them as resolved or regression.
The default value oh display_errors is on the page, you referenced, right at the top:
https://secure.php.net/manual/en/errorfunc.configuration.php
usage and risks of display_errors (including "dont use in in prod!") is basic knowledge for php development.
To the "why the stacktrace": cause it was an uncaught exception. The same happens in java (e.g. with uncaught NullPointerExceptions) and many other languages. Exceptions must be caught.
it's sad, that this is another post, that makes php look bad (/worse) because of (basic/beginner) errors.
https://secure.php.net/manual/en/errorfunc.configuration.php
usage and risks of display_errors (including "dont use in in prod!") is basic knowledge for php development.
To the "why the stacktrace": cause it was an uncaught exception. The same happens in java (e.g. with uncaught NullPointerExceptions) and many other languages. Exceptions must be caught.
it's sad, that this is another post, that makes php look bad (/worse) because of (basic/beginner) errors.
Na, sagen Sie mal, dafür dass sie ein IT-Spezialist sind, sollten Sie ihren Blog aber wirklich besser pflegen! Sie arbeiten mit einer völlig veralteten S9Y-Version!
;-)
mfg
Gerd Höller
;-)
mfg
Gerd Höller