File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -514,9 +514,23 @@ static bool TryMatchHttpStatusHeader(ReadOnlySpan<char> header, out int code)
514514 /// </remarks>
515515 public static void header ( Context ctx , string str , bool replace = true , int http_response_code = 0 )
516516 {
517+ if ( string . IsNullOrEmpty ( str ) )
518+ {
519+ // empty arg, ignore
520+ //PhpException.InvalidArgument(nameof(str));
521+ return ;
522+ }
523+
517524 var webctx = ctx . HttpPhpContext ;
518- if ( webctx == null || string . IsNullOrEmpty ( str ) || webctx . HeadersSent )
525+ if ( webctx == null )
526+ {
527+ // ignore on console app
528+ return ;
529+ }
530+
531+ if ( webctx . HeadersSent )
519532 {
533+ // header sent
520534 PhpException . Throw ( PhpError . Notice , Resources . Resources . headers_has_been_sent ) ;
521535 return ;
522536 }
You can’t perform that action at this time.
0 commit comments