Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/HTTP/CLIRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getOptionString(bool $useLongOpts = false): string
*/
protected function parseCommand()
{
$args = $this->getServer('argv');
$args = $this->getServer('argv') ?? [];
array_shift($args); // Scrap index.php

$optionValue = false;
Expand Down
11 changes: 11 additions & 0 deletions tests/system/HTTP/CLIRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,4 +574,15 @@ public function testIs(): void
{
$this->assertFalse($this->request->is('get'));
}

public function testParseCommandWithMissingArgv(): void
{
Services::injectMock('superglobals', new Superglobals([], [], [], [], []));

$request = new CLIRequest(new App());

$this->assertSame('', $request->getPath());
$this->assertSame([], $request->getSegments());
$this->assertSame('', $request->getOptionString());
}
}
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.7.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Deprecations
Bugs Fixed
**********

- **CLIRequest:** Fixed a bug where ``parseCommand()`` could throw a TypeError when ``argv`` is missing.
- **Content Security Policy:** Fixed a bug where empty ``Content-Security-Policy``, ``Content-Security-Policy-Report-Only``, and ``Reporting-Endpoints`` response headers were generated when no corresponding values existed.
- **Logger:** Fixed a bug where interpolating a log message with array or non-stringable context values could raise PHP warnings or errors.

Expand Down
Loading