mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX Ensure phpdbg calls are registered by SilverStripe core as a CLI call
This commit is contained in:
parent
7fd316d405
commit
ea4181166f
@ -944,7 +944,7 @@ class Director implements TemplateGlobalProvider
|
|||||||
*/
|
*/
|
||||||
public static function is_cli()
|
public static function is_cli()
|
||||||
{
|
{
|
||||||
return php_sapi_name() === "cli";
|
return in_array(php_sapi_name(), ['cli', 'phpdbg']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -761,4 +761,12 @@ class DirectorTest extends SapphireTest
|
|||||||
$this->assertEquals(2, $middleware->preCalls);
|
$this->assertEquals(2, $middleware->preCalls);
|
||||||
$this->assertEquals(1, $specificMiddleware->postCalls);
|
$this->assertEquals(1, $specificMiddleware->postCalls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If using phpdbg it returns itself instead of "cli" from php_sapi_name()
|
||||||
|
*/
|
||||||
|
public function testIsCli()
|
||||||
|
{
|
||||||
|
$this->assertTrue(Director::is_cli(), 'is_cli should be true for PHP CLI and phpdbg');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user