This repository was archived by the owner on Jan 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ class Drupal implements DrupalInterface
5252 */
5353 protected $ state ;
5454
55+ /**
56+ * @var Response
57+ */
58+ protected $ response ;
59+
5560 /**
5661 * @var array
5762 */
@@ -87,7 +92,7 @@ public function __construct($root, UserManagerInterface $userManager)
8792 {
8893 $ this ->root = $ root ;
8994 $ this ->state = self ::STATE_FRESH ;
90- $ this ->response = new Response ;
95+ $ this ->response = new Response () ;
9196 $ this ->encapsulated = false ;
9297 $ this ->disableResponse = false ;
9398 $ this ->userManager = $ userManager ;
@@ -227,6 +232,12 @@ public function shutdown($level)
227232 $ this ->response ->headers ->set ($ name , $ value );
228233 }
229234
235+ $ statusCode = http_response_code ();
236+
237+ if ($ statusCode !== false ) {
238+ $ this ->response ->setStatusCode ($ statusCode );
239+ }
240+
230241 $ content = ob_get_contents ();
231242
232243 $ this ->response ->setContent ($ content );
@@ -401,6 +412,12 @@ public function render()
401412
402413 $ this ->response ->setContent ($ content );
403414
415+ $ statusCode = http_response_code ();
416+
417+ if ($ statusCode !== false ) {
418+ $ this ->response ->setStatusCode ($ statusCode );
419+ }
420+
404421 $ this ->state = self ::STATE_RESPONSE ;
405422 }
406423
You can’t perform that action at this time.
0 commit comments