From b927cd2bf5c1bba55f27feccdbc8ff4e62fd1317 Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Tue, 10 Mar 2026 02:39:04 +0200 Subject: [PATCH] Fix missing mbstring: replace mb_strtolower with strtolower Production server (PHP 8.4) doesn't have mbstring extension, causing 500 error on saatavuus endpoint. Co-Authored-By: Claude Opus 4.6 --- api.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/api.php b/api.php index 6012fac..076f58d 100644 --- a/api.php +++ b/api.php @@ -1,20 +1,4 @@ $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); @@ -117,7 +101,7 @@ function saveConfig(array $config): void { } function normalizeAddress(string $addr): string { - $addr = mb_strtolower(trim($addr)); + $addr = strtolower(trim($addr)); $addr = preg_replace('/\s+/', ' ', $addr); return $addr; } @@ -318,7 +302,7 @@ switch ($action) { foreach ($c['liittymat'] ?? [] as $l) { $addr = normalizeAddress($l['asennusosoite'] ?? ''); $zip = trim($l['postinumero'] ?? ''); - $city = mb_strtolower(trim($l['kaupunki'] ?? '')); + $city = strtolower(trim($l['kaupunki'] ?? '')); $hit = false; // Postinumero-haku