From 3a47fbb75ad0f8fded41d4b637c38e25a468a679 Mon Sep 17 00:00:00 2001 From: Joanhey Date: Mon, 14 Sep 2020 14:01:18 +0200 Subject: [PATCH] Fix headers_sent() in cli SAPI --- src/AdapterFunctions.php | 13 ++++++++++++- src/Adapterman.php | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/AdapterFunctions.php b/src/AdapterFunctions.php index c6cb415..648d7a0 100644 --- a/src/AdapterFunctions.php +++ b/src/AdapterFunctions.php @@ -23,6 +23,17 @@ function header_remove(string $name): void Http::headerRemove($name); //TODO fix case-insensitive } +/** + * Checks if or where headers have been sent + * Always false with Workerman and CLI, Fix problem with cli SAPI + * + * @return bool + */ +function headers_sent($file = null, $line = null): bool +{ + return false; +} + /** * Get or Set the HTTP response code * @@ -33,7 +44,7 @@ function header_remove(string $name): void */ function http_response_code(int $code = null): int { // int|bool - return Http::responseCode($code); + return Http::responseCode($code); // Fix to return actual status when void } /** diff --git a/src/Adapterman.php b/src/Adapterman.php index c6bcef9..5cfc07d 100644 --- a/src/Adapterman.php +++ b/src/Adapterman.php @@ -6,11 +6,11 @@ class Adapterman { - public const VERSION = "0.3"; + public const VERSION = "0.4"; - private const NAME = "Adapterman v". self::VERSION; + public const NAME = "Adapterman v". self::VERSION; - private const FUNCTIONS = ['header', 'header_remove', 'http_response_code', 'setcookie', 'session_create_id', 'session_id', 'session_name', 'session_save_path', 'session_status', 'session_start', 'session_write_close', 'set_time_limit']; + private const FUNCTIONS = ['header', 'header_remove', 'headers_sent', 'http_response_code', 'setcookie', 'session_create_id', 'session_id', 'session_name', 'session_save_path', 'session_status', 'session_start', 'session_write_close', 'set_time_limit']; public static function init(): void {