Skip to content

Commit 8f146c2

Browse files
committed
Fixed bug #65678 the test cli_process_title_windows will fails on particular environnement
Patch by Pierre Renaudet
1 parent dfa43d5 commit 8f146c2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sapi/cli/tests/cli_process_title_windows.phpt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
2020
// no warnings/errors.
2121

2222
$is_windows8 = false;
23-
$ps_output = shell_exec("PowerShell \"(Get-Host).UI.RawUI.WindowTitle\"");
23+
$ps_output = shell_exec("PowerShell -NoProfile \"(Get-Host).UI.RawUI.WindowTitle\"");
2424
if ($ps_output === null)
2525
{
2626
echo "Get-Host failed\n";
2727
die();
2828
}
2929

3030
$ps_output = trim($ps_output);
31-
if (($ps_output == "Windows PowerShell") || ($ps_output == "Administrator: Windows PowerShell"))
31+
$end_title_windows8 = ": Windows PowerShell";
32+
if (($ps_output == "Windows PowerShell") || (strlen($ps_output) > strlen($end_title_windows8) && substr($ps_output,-strlen($end_title_windows8)) === $end_title_windows8))
3233
$is_windows8 = true;
3334

3435
echo "*** Testing setting the process title ***\n";
@@ -45,7 +46,7 @@ if ($is_windows8)
4546
}
4647
else
4748
{
48-
$loaded_title = shell_exec("PowerShell \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\"");
49+
$loaded_title = shell_exec("PowerShell -NoProfile \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\"");
4950

5051
if ($loaded_title === null)
5152
{

0 commit comments

Comments
 (0)