troubleshooting

main
Yasen Pramatarov 2026-04-11 19:15:09 +03:00
parent 598458f53c
commit 665d5bded9
3 changed files with 11 additions and 8 deletions

View File

@ -39,6 +39,9 @@ class ApiResponse {
* @param int $status HTTP status code * @param int $status HTTP status code
*/ */
private static function send($data, $status) { private static function send($data, $status) {
while (ob_get_level() > 0) {
ob_end_clean();
}
http_response_code($status); http_response_code($status);
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($data); echo json_encode($data);

View File

@ -17,8 +17,8 @@ class Session {
} }
private static $sessionOptions = [ private static $sessionOptions = [
'cookie_httponly' => 1, 'cookie_httponly' => 1,
'cookie_secure' => 1, 'cookie_secure' => 0,
'cookie_samesite' => 'Strict', 'cookie_samesite' => 'Lax',
'gc_maxlifetime' => 7200 // 2 hours 'gc_maxlifetime' => 7200 // 2 hours
]; ];
@ -52,13 +52,13 @@ class Session {
'domain' => $thisDomain, 'domain' => $thisDomain,
'secure' => $isSecure, 'secure' => $isSecure,
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Lax'
]); ]);
} }
// Align session start options dynamically with current transport // Align session start options dynamically with current transport
self::$sessionOptions['cookie_secure'] = $isSecure ? 1 : 0; self::$sessionOptions['cookie_secure'] = $isSecure ? 1 : 0;
self::$sessionOptions['cookie_samesite'] = 'Strict'; self::$sessionOptions['cookie_samesite'] = 'Lax';
self::$initialized = true; self::$initialized = true;
} }
@ -181,7 +181,7 @@ class Session {
'domain' => $config['domain'], 'domain' => $config['domain'],
'secure' => isset($_SERVER['HTTPS']), 'secure' => isset($_SERVER['HTTPS']),
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Lax'
]); ]);
} }
@ -219,7 +219,7 @@ class Session {
'domain' => $config['domain'] ?? '', 'domain' => $config['domain'] ?? '',
'secure' => isset($_SERVER['HTTPS']), 'secure' => isset($_SERVER['HTTPS']),
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Lax'
] ]
); );
@ -230,7 +230,7 @@ class Session {
'domain' => $config['domain'] ?? '', 'domain' => $config['domain'] ?? '',
'secure' => isset($_SERVER['HTTPS']), 'secure' => isset($_SERVER['HTTPS']),
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Lax'
]); ]);
} }

View File

@ -63,7 +63,7 @@ class Validator {
} }
break; break;
case 'phone': case 'phone':
if (!empty($value) && !preg_match('/^[+]?[\d\s-()]{7,}$/', $value)) { if (!empty($value) && !preg_match('/^(\+?\d{1,4})?\s?(\d[\d\s]{6,})$/', $value)) {
$this->addError($field, "Invalid phone number format"); $this->addError($field, "Invalid phone number format");
} }
break; break;