Keep PHP notices out of login API JSON responses
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
// app/session.php
|
// app/session.php
|
||||||
ob_start(); // ensure output buffering is on regardless of php.ini — prevents stray output from corrupting JSON API responses
|
ob_start(); // ensure output buffering is on regardless of php.ini — prevents stray output from corrupting JSON API responses
|
||||||
|
|
||||||
|
// The buffer is still flushed, so notices would still land in front of the JSON
|
||||||
|
// body and break the client's parse ("Server error occurred."). The login API
|
||||||
|
// engines load this file instead of db_auth.php, so apply the same policy here.
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
ini_set('log_errors', '1');
|
||||||
|
|
||||||
if (session_status() === PHP_SESSION_NONE) {
|
if (session_status() === PHP_SESSION_NONE) {
|
||||||
|
|
||||||
// Derive cookie path dynamically from the current script location.
|
// Derive cookie path dynamically from the current script location.
|
||||||
|
|||||||
Reference in New Issue
Block a user