Add temporary error reporting to debug 500 on saatavuus endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 02:37:16 +02:00
parent b8b3fb422a
commit 37e6f6b90e

16
api.php
View File

@@ -1,4 +1,20 @@
<?php
// Virheraportointi (debug)
error_reporting(E_ALL);
ini_set('display_errors', 0);
set_error_handler(function($errno, $errstr, $errfile, $errline) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['php_error' => $errstr, 'file' => basename($errfile), 'line' => $errline]);
exit;
});
set_exception_handler(function($e) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['php_exception' => $e->getMessage(), 'file' => basename($e->getFile()), 'line' => $e->getLine()]);
exit;
});
// Turvalliset session-asetukset
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', 1);