Skip to content

Commit 05966db

Browse files
committed
fix: bug that if body is '0', $this->body will be null
1 parent 5e4e13b commit 05966db

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

system/HTTP/IncomingRequest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,14 @@ public function __construct($config, ?URI $uri = null, $body = 'php://input', ?U
169169
$body = file_get_contents('php://input');
170170
}
171171

172+
// If file_get_contents() returns false or empty string, set null.
173+
if ($body === false || $body === '') {
174+
$body = null;
175+
}
176+
172177
$this->config = $config;
173178
$this->uri = $uri;
174-
$this->body = ! empty($body) ? $body : null;
179+
$this->body = $body;
175180
$this->userAgent = $userAgent;
176181
$this->validLocales = $config->supportedLocales;
177182

0 commit comments

Comments
 (0)