Skip to content

Commit 8b6f9ab

Browse files
committed
Prefer http_response_code() if it is defined
1 parent bf62553 commit 8b6f9ab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Integration/LegacyCaptureResponseFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ class LegacyCaptureResponseFactory
1818
public static function create($legacyExecutionCallback)
1919
{
2020
ob_start();
21+
2122
$statusCode = call_user_func($legacyExecutionCallback) ? : 200;
2223

24+
if (function_exists('http_response_code')) {
25+
$statusCode = http_response_code();
26+
}
27+
2328
if (headers_sent()) {
2429
throw new LegacyIntegrationException("It must be possible to caputure the legacy application's output with ob_start(). Headers and/or output must not have been sent to the client.");
2530
}

0 commit comments

Comments
 (0)