Skip to content

Commit

Permalink
Fix headers_sent() in cli SAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Sep 14, 2020
1 parent c5882fb commit 3a47fbb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/AdapterFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Adapterman.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 3a47fbb

Please sign in to comment.