Skip to content

Commit 879872d

Browse files
authored
Prevent 'Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, null given' (#47)
* fix: prevent 'explode' error when responseContentType is null. * always use casting to string to hit more cases.
1 parent c7bf42d commit 879872d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function _failed(TestInterface $test, $fail)
9797
$internalResponse = false;
9898
}
9999

100-
$responseContentType = $internalResponse ? $internalResponse->getHeader('content-type') : '';
100+
$responseContentType = $internalResponse ? (string) $internalResponse->getHeader('content-type') : '';
101101
[$responseMimeType] = explode(';', $responseContentType);
102102

103103
$extension = $extensions[$responseMimeType] ?? 'html';

0 commit comments

Comments
 (0)