zoe Mon Jul 6 21:01:02 2009 UTC Added files: /phpruntests/QA/sapi/cli/tests 002-win32.phpt skipif.inc 009.phpt 003-2.phpt 019.phpt 007.phpt 017.phpt 005.phpt 015.phpt 003.phpt 013.phpt 001.phpt 011.phpt 021.phpt bug44564.phpt 008.phpt 018.phpt 022.inc 006.phpt 016.phpt 010-2.phpt 004.phpt 014.phpt 002.phpt 012.phpt 022.phpt 010.phpt 020.phpt Log: building test suite
http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/002-win32.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/002-win32.phpt +++ phpruntests/QA/sapi/cli/tests/002-win32.phpt --TEST-- running code with -r --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) != 'WIN') { die ("skip only for Windows"); } ?> --FILE-- <?php
$php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n -r "var_dump('hello');"`); echo "Done\n"; ?> --EXPECTF-- string(18) "string(5) "hello" " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/skipif.inc?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/skipif.inc +++ phpruntests/QA/sapi/cli/tests/skipif.inc <?php if (php_sapi_name() != "cli") { die("skip CLI only"); } ?> http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/009.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/009.phpt +++ phpruntests/QA/sapi/cli/tests/009.phpt --TEST-- using invalid combinations of cmdline options --SKIPIF-- <?php include "skipif.inc"; ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n -a -r "echo hello;"`); var_dump(`$php -n -r "echo hello;" -a`); echo "Done\n"; ?> --EXPECTF-- Either execute direct code, process stdin or use a file. NULL Either execute direct code, process stdin or use a file. NULL Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/003-2.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/003-2.phpt +++ phpruntests/QA/sapi/cli/tests/003-2.phpt --TEST-- defining INI options with -d (as 2nd arg) --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`"$php" -nd max_execution_time=111 -r 'var_dump(ini_get("max_execution_time"));'`); var_dump(`"$php" -nd max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`); ?> ===DONE=== --EXPECTF-- string(16) "string(3) "111" " string(16) "string(3) "500" " ===DONE=== http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/019.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/019.phpt +++ phpruntests/QA/sapi/cli/tests/019.phpt --TEST-- CLI php -i --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); echo `"$php" -n -i`; echo "\nDone\n"; ?> --EXPECTF-- phpinfo() PHP Version => %s %a PHP License This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact lice...@php.net. Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/007.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/007.phpt +++ phpruntests/QA/sapi/cli/tests/007.phpt --TEST-- strip comments and whitespace with -w --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = dirname(__FILE__).'/007.test.php'; $code =' <?php /* some test script */ class test { /* {{{ */ public $var = "test"; //test var #perl style comment private $pri; /* private attr */ function foo(/* void */) { } } /* }}} */ ?> '; file_put_contents($filename, $code); var_dump(`$php -n -w "$filename"`); var_dump(`$php -n -w "wrong"`); var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- string(81) " <?php class test { public $var = "test"; private $pri; function foo() { } } ?> " Could not open input file: wrong NULL string(43) "<?php class test { function foo() {} } ?> " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/017.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/017.phpt +++ phpruntests/QA/sapi/cli/tests/017.phpt --TEST-- CLI -a and libedit --SKIPIF-- <?php include "skipif.inc"; if (!extension_loaded('readline') || readline_info('done') !== NULL) { die ("skip need readline support using libedit"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $codes = array(); $codes[1] = <<<EOT echo 'Hello world'; exit EOT; $codes[] = <<<EOT echo 'multine single quote'; exit EOT; $codes[] = <<<EOT echo <<<HEREDOC Here comes the doc HEREDOC; EOT; $codes[] = <<<EOT if (0) { echo "I'm not there"; } echo "Done"; EOT; $codes[] = <<<EOT function a_function_with_some_name() { echo "I was called!"; } a_function_w ); EOT; foreach ($codes as $key => $code) { echo "\n--------------\nSnippet no. $key:\n--------------\n"; $code = escapeshellarg($code); echo `echo $code | "$php" -a`, "\n"; } echo "\nDone\n"; ?> --EXPECTF-- -------------- Snippet no. 1: -------------- Interactive shell Hello world -------------- Snippet no. 2: -------------- Interactive shell multine single quote -------------- Snippet no. 3: -------------- Interactive shell Here comes the doc -------------- Snippet no. 4: -------------- Interactive shell Done -------------- Snippet no. 5: -------------- Interactive shell Parse error: syntax error, unexpected ')' in php shell code on line 1 Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/005.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/005.phpt +++ phpruntests/QA/sapi/cli/tests/005.phpt --TEST-- show information about class --SKIPIF-- <?php include "skipif.inc"; if (!extension_loaded("reflection")) { die("skip"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`"$php" -n --rc unknown`); var_dump(`"$php" -n --rc stdclass`); var_dump(`"$php" -n --rc exception`); echo "Done\n"; ?> --EXPECTF-- string(40) "Exception: Class unknown does not exist " string(183) "Class [ <internal:Core> class stdClass ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } } " string(1355) "Class [ <internal:Core> class Exception ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [7] { Property [ <default> protected $message ] Property [ <default> private $string ] Property [ <default> protected $code ] Property [ <default> protected $file ] Property [ <default> protected $line ] Property [ <default> private $trace ] Property [ <default> private $previous ] } - Methods [10] { Method [ <internal:Core> final private method __clone ] { } Method [ <internal:Core, ctor> public method __construct ] { - Parameters [3] { Parameter #0 [ <optional> $message ] Parameter #1 [ <optional> $code ] Parameter #2 [ <optional> $previous ] } } Method [ <internal:Core> final public method getMessage ] { } Method [ <internal:Core> final public method getCode ] { } Method [ <internal:Core> final public method getFile ] { } Method [ <internal:Core> final public method getLine ] { } Method [ <internal:Core> final public method getTrace ] { } Method [ <internal:Core> final public method getPrevious ] { } Method [ <internal:Core> final public method getTraceAsString ] { } Method [ <internal:Core> public method __toString ] { } } } " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/015.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/015.phpt +++ phpruntests/QA/sapi/cli/tests/015.phpt --TEST-- CLI long options --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); echo `"$php" -n --version | grep built:`; echo `echo "<?php print_r(\\\$argv);" | "$php" -n -- foo bar baz`, "\n"; echo `"$php" -n --version foo bar baz | grep built:`; echo `"$php" -n --notexisting foo bar baz | grep Usage:`; echo "Done\n"; ?> --EXPECTF-- PHP %d.%d.%d%s(cli) (built: %s)%s Array ( [0] => - [1] => foo [2] => bar [3] => baz ) PHP %d.%d.%d%s(cli) (built: %s)%s Usage: %s [options] [-f] <file> [--] [args...] Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/003.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/003.phpt +++ phpruntests/QA/sapi/cli/tests/003.phpt --TEST-- defining INI options with -d --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n -d max_execution_time=111 -r 'var_dump(ini_get("max_execution_time"));'`); var_dump(`$php -n -d max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`); var_dump(`$php -n -d max_execution_time=500 -d max_execution_time=555 -r 'var_dump(ini_get("max_execution_time"));'`); var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 -r 'var_dump(ini_get("max_execution_time")); var_dump(ini_get("upload_tmp_dir"));'`); echo "Done\n"; ?> --EXPECTF-- string(16) "string(3) "111" " string(16) "string(3) "500" " string(16) "string(3) "555" " string(40) "string(3) "555" string(10) "/test/path" " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/013.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/013.phpt +++ phpruntests/QA/sapi/cli/tests/013.phpt --TEST-- running PHP code before and after processing input lines with -B and -E --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename_txt = dirname(__FILE__)."/013.test.txt"; file_put_contents($filename_txt, "test\nfile\ncontents\n"); var_dump(`cat "$filename_txt" | "$php" -n -B 'var_dump("start");'`); var_dump(`cat "$filename_txt" | "$php" -n -E 'var_dump("end");'`); var_dump(`cat "$filename_txt" | "$php" -n -B 'var_dump("start");' -E 'var_dump("end");'`); @unlink($filename_txt); echo "Done\n"; ?> --EXPECTF-- string(18) "string(5) "start" " string(16) "string(3) "end" " string(34) "string(5) "start" string(3) "end" " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/001.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/001.phpt +++ phpruntests/QA/sapi/cli/tests/001.phpt --TEST-- version string --SKIPIF-- <?php include "skipif.inc"; ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n -v`); echo "Done\n"; ?> --EXPECTF-- string(%d) "PHP %s (cli) (built: %s)%s Copyright (c) 1997-20%d The PHP Group Zend Engine v%s, Copyright (c) 1998-20%d Zend Technologies " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/011.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/011.phpt +++ phpruntests/QA/sapi/cli/tests/011.phpt --TEST-- syntax check --SKIPIF-- <?php include "skipif.inc"; ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = dirname(__FILE__)."/011.test.php"; $code = ' <?php $test = "var"; class test { private $var; } echo test::$var; ?> '; file_put_contents($filename, $code); var_dump(`"$php" -n -l $filename`); var_dump(`"$php" -n -l some.unknown`); $code = ' <?php class test private $var; } ?> '; file_put_contents($filename, $code); var_dump(`"$php" -n -l $filename`); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- string(%d) "No syntax errors detected in %s011.test.php " Could not open input file: some.unknown NULL string(%d) " Parse error: %s expecting %s{%s in %s on line %d Errors parsing %s011.test.php " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/021.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/021.phpt +++ phpruntests/QA/sapi/cli/tests/021.phpt --TEST-- CLI shell shebang --SKIPIF-- <?php include 'skipif.inc'; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = __DIR__.'/021.tmp.php'; $script = "#!$php -n\n". "ola\n". "<?php echo 1+1,'\n';\n". "?>\n". "adeus\n"; file_put_contents($filename, $script); chmod($filename, 0777); echo `$filename`; echo "\nDone\n"; ?> --CLEAN-- <?php unlink(__DIR__.'/021.tmp.php'); ?> --EXPECTF-- ola 2 adeus Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/bug44564.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/bug44564.phpt +++ phpruntests/QA/sapi/cli/tests/bug44564.phpt --TEST-- Bug #44564 (escapeshellarg removes UTF-8 multi-byte characters) --SKIPIF-- <?php if (false == setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8")) { die("skip setlocale() failed\n"); } ?> --FILE-- <?php setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8"); var_dump(escapeshellcmd('f{o}<â¬>')); var_dump(escapeshellarg('f~|;*Ã?')); var_dump(escapeshellcmd('?â¬Â®Äæ?')); var_dump(escapeshellarg('aÅÅâ¬')); ?> --EXPECT-- string(13) "f\{o\}\<â¬\>" string(10) "'f~|;*Ã?'" string(13) "\?â¬Â®Äæ\?" string(10) "'aÅÅâ¬'" http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/008.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/008.phpt +++ phpruntests/QA/sapi/cli/tests/008.phpt --TEST-- execute a file with -f --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = dirname(__FILE__).'/008.test.php'; $code =' <?php class test { private $pri; } var_dump(test::$pri); ?> '; file_put_contents($filename, $code); var_dump(`$php -n -f "$filename"`); var_dump(`$php -n -f "wrong"`); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- string(%d) " Fatal error: Cannot access private property test::$pri in %s on line %d " Could not open input file: wrong NULL Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/018.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/018.phpt +++ phpruntests/QA/sapi/cli/tests/018.phpt --TEST-- CLI php -m --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); echo `"$php" -n -m`; echo "Done\n"; ?> --EXPECTF-- [PHP Modules] %a pcre %a [Zend Modules] %aDone http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/022.inc?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/022.inc +++ phpruntests/QA/sapi/cli/tests/022.inc <?php ob_start(); var_dump(STDIN); $fd = fopen("php://stdin","r"); var_dump($fd); $client_socket = stream_socket_accept($fd); $data = ob_get_clean(); fwrite($client_socket, $data); ?> http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/006.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/006.phpt +++ phpruntests/QA/sapi/cli/tests/006.phpt --TEST-- show information about extension --SKIPIF-- <?php include "skipif.inc"; if (!extension_loaded("reflection") || !extension_loaded("session")) { die("skip"); } ?> --INI-- date.timezone= --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n --re unknown`); var_dump(`$php -n --re ""`); var_dump(`$php -n --re pcre`); echo "Done\n"; ?> --EXPECTF-- string(44) "Exception: Extension unknown does not exist " string(37) "Exception: Extension does not exist " string(%d) "Extension [ <persistent> extension #%d pcre version <no_version> ] { - INI { Entry [ pcre.backtrack_limit <ALL> ] Current = '%d' } Entry [ pcre.recursion_limit <ALL> ] Current = '%d' } } - Constants [14] { Constant [ integer PREG_PATTERN_ORDER ] { 1 } Constant [ integer PREG_SET_ORDER ] { 2 } Constant [ integer PREG_OFFSET_CAPTURE ] { 256 } Constant [ integer PREG_SPLIT_NO_EMPTY ] { 1 } Constant [ integer PREG_SPLIT_DELIM_CAPTURE ] { 2 } Constant [ integer PREG_SPLIT_OFFSET_CAPTURE ] { 4 } Constant [ integer PREG_GREP_INVERT ] { 1 } Constant [ integer PREG_NO_ERROR ] { 0 } Constant [ integer PREG_INTERNAL_ERROR ] { 1 } Constant [ integer PREG_BACKTRACK_LIMIT_ERROR ] { 2 } Constant [ integer PREG_RECURSION_LIMIT_ERROR ] { 3 } Constant [ integer PREG_BAD_UTF8_ERROR ] { 4 } Constant [ integer PREG_BAD_UTF8_OFFSET_ERROR ] { 5 } Constant [ string PCRE_VERSION ] { %s } } - Functions { Function [ <internal:pcre> function preg_match ] { - Parameters [5] { Parameter #0 [ <required> $pattern ] Parameter #1 [ <required> $subject ] Parameter #2 [ <optional> &$subpatterns ] Parameter #3 [ <optional> $flags ] Parameter #4 [ <optional> $offset ] } } Function [ <internal:pcre> function preg_match_all ] { - Parameters [5] { Parameter #0 [ <required> $pattern ] Parameter #1 [ <required> $subject ] Parameter #2 [ <required> &$subpatterns ] Parameter #3 [ <optional> $flags ] Parameter #4 [ <optional> $offset ] } } Function [ <internal:pcre> function preg_replace ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] Parameter #2 [ <optional> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } } Function [ <internal:pcre> function preg_replace_callback ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $callback ] Parameter #2 [ <required> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } } Function [ <internal:pcre> function preg_filter ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] Parameter #2 [ <optional> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } } Function [ <internal:pcre> function preg_split ] { - Parameters [4] { Parameter #0 [ <required> $pattern ] Parameter #1 [ <required> $subject ] Parameter #2 [ <optional> $limit ] Parameter #3 [ <optional> $flags ] } } Function [ <internal:pcre> function preg_quote ] { - Parameters [2] { Parameter #0 [ <required> $str ] Parameter #1 [ <optional> $delim_char ] } } Function [ <internal:pcre> function preg_grep ] { - Parameters [3] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $input ] Parameter #2 [ <optional> $flags ] } } Function [ <internal:pcre> function preg_last_error ] { - Parameters [0] { } } } } " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/016.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/016.phpt +++ phpruntests/QA/sapi/cli/tests/016.phpt --TEST-- CLI -a and readline --SKIPIF-- <?php include "skipif.inc"; if (!extension_loaded('readline') || readline_info('done') === NULL) { die ("skip need readline support"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); // disallow console escape sequences that may break the output putenv('TERM=VT100'); $codes = array(); $codes[1] = <<<EOT echo 'Hello world'; exit EOT; $codes[] = <<<EOT echo 'multine single quote'; exit EOT; $codes[] = <<<EOT echo <<<HEREDOC Here comes the doc HEREDOC; EOT; $codes[] = <<<EOT if (0) { echo "I'm not there"; } echo "Done"; EOT; $codes[] = <<<EOT function a_function_with_some_name() { echo "I was called!"; } a_function_w ); EOT; foreach ($codes as $key => $code) { echo "\n--------------\nSnippet no. $key:\n--------------\n"; $code = escapeshellarg($code); echo `echo $code | "$php" -a`, "\n"; } echo "\nDone\n"; ?> --EXPECTF-- -------------- Snippet no. 1: -------------- Interactive shell php > Hello world php > -------------- Snippet no. 2: -------------- Interactive shell php > php ' php ' multine single quote php > -------------- Snippet no. 3: -------------- Interactive shell php > <<< > <<< > <<< > <<< > <<< > Here comes the doc php > -------------- Snippet no. 4: -------------- Interactive shell php > php { php { php > Done php > -------------- Snippet no. 5: -------------- Interactive shell php > php { php { php > I was called! php > Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/010-2.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/010-2.phpt +++ phpruntests/QA/sapi/cli/tests/010-2.phpt --TEST-- executing a code with -R --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename_txt = dirname(__FILE__)."/010.test.txt"; $txt = ' test hello '; file_put_contents($filename_txt, $txt); var_dump(`cat "$filename_txt" | "$php" -n -R "var_dump(1);"`); @unlink($filename_txt); echo "Done\n"; ?> --EXPECTF-- string(21) "int(1) int(1) int(1) " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/004.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/004.phpt +++ phpruntests/QA/sapi/cli/tests/004.phpt --TEST-- show information about function --SKIPIF-- <?php include "skipif.inc"; if (!extension_loaded("reflection")) { die("skip"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n --rf unknown`); var_dump(`$php -n --rf echo`); var_dump(`$php -n --rf phpinfo`); echo "Done\n"; ?> --EXPECTF-- string(45) "Exception: Function unknown() does not exist " string(42) "Exception: Function echo() does not exist " string(119) "Function [ <internal:standard> function phpinfo ] { - Parameters [1] { Parameter #0 [ <optional> $what ] } } " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/014.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/014.phpt +++ phpruntests/QA/sapi/cli/tests/014.phpt --TEST-- syntax highlighting --SKIPIF-- <?php include "skipif.inc"; ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = dirname(__FILE__)."/014.test.php"; $code = ' <?php $test = "var"; //var /* test class */ class test { private $var = array(); public static function foo(Test $arg) { echo "hello"; var_dump($this); } } $o = new test; ?> '; file_put_contents($filename, $code); var_dump(`"$php" -n -s $filename`); var_dump(`"$php" -n -s unknown`); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- string(1478) "<code><span style="color: #000000"> <br /><span style="color: #0000BB"><?php<br />$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var<br />/* test class */<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{<br /> private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();<br /><br /> public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br /> </span! ><span style="color: #0000BB">var_dump</span><span style="color: >#007700">(</span><span style="color: #0000BB">$this</span><span style="color: >#007700">);<br /> }<br />}<br /><br /></span><span >style="color: #0000BB">$o </span><span style="color: >#007700">= new </span><span style="color: #0000BB">test</span><span >style="color: #007700">;<br /></span><span style="color: #0000BB">?><br >/></span> </span> </code>" Could not open input file: unknown NULL Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/002.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/002.phpt +++ phpruntests/QA/sapi/cli/tests/002.phpt --TEST-- running code with -r --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`$php -n -r 'var_dump("hello");'`); echo "Done\n"; ?> --EXPECTF-- string(18) "string(5) "hello" " Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/012.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/012.phpt +++ phpruntests/QA/sapi/cli/tests/012.phpt --TEST-- invalid arguments and error messages --SKIPIF-- <?php include "skipif.inc"; ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); var_dump(`"$php" -n -F some.php -F some.php`); var_dump(`"$php" -n -F some.php -R some.php`); var_dump(`"$php" -n -R some.php -F some.php`); var_dump(`"$php" -n -R some.php -R some.php`); var_dump(`"$php" -n -f some.php -f some.php`); var_dump(`"$php" -n -B '' -B ''`); var_dump(`"$php" -n -E '' -E ''`); var_dump(`"$php" -n -r '' -r ''`); echo "Done\n"; ?> --EXPECTF-- You can use -R or -F only once. NULL You can use -R or -F only once. NULL You can use -R or -F only once. NULL You can use -R or -F only once. NULL You can use -f only once. NULL You can use -B only once. NULL You can use -E only once. NULL You can use -r only once. NULL Done http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/022.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/022.phpt +++ phpruntests/QA/sapi/cli/tests/022.phpt --TEST-- STDIN/OUT/ERR stream type --SKIPIF-- <?php if (!getenv("TEST_PHP_EXECUTABLE")) die("skip TEST_PHP_EXECUTABLE not set"); if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test"); ?> --FILE-- <?php $php = getenv("TEST_PHP_EXECUTABLE"); $socket_file = dirname(__FILE__) . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock'; $test_file = dirname(__FILE__) . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc'; if (file_exists($socket_file)) { unlink($socket_file); } $socket = stream_socket_server('unix://' . $socket_file); var_dump($socket); if (!$socket) { exit(1); } $desc = array( 0 => $socket, 1 => STDOUT, 2 => STDERR, ); $pipes = array(); $proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes); var_dump($proc); if (!$proc) { exit(1); } $client_socket = stream_socket_client('unix://' . $socket_file); var_dump($client_socket); echo stream_get_contents($client_socket); fclose($client_socket); proc_terminate($proc); proc_close($proc); unlink($socket_file); ?> --EXPECTF-- resource(%d) of type (stream) resource(%d) of type (process) resource(%d) of type (stream) resource(%d) of type (stream) resource(%d) of type (stream) http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/010.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/010.phpt +++ phpruntests/QA/sapi/cli/tests/010.phpt --TEST-- executing a file with -F --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); $filename = __DIR__."/010.test.php"; $filename_txt = __DIR__."/010.test.txt"; $code = ' <?php var_dump(fread(STDIN, 10)); ?> '; file_put_contents($filename, $code); $txt = ' test hello'; file_put_contents($filename_txt, $txt); var_dump(`cat "$filename_txt" | "$php" -n -F "$filename"`); ?> ===DONE=== --CLEAN-- <?php @unlink(__DIR__."/010.test.php"); @unlink(__DIR__."/010.test.txt"); ?> --EXPECTF-- string(25) " string(10) "test hello" " ===DONE=== http://cvs.php.net/viewvc.cgi/phpruntests/QA/sapi/cli/tests/020.phpt?view=markup&rev=1.1 Index: phpruntests/QA/sapi/cli/tests/020.phpt +++ phpruntests/QA/sapi/cli/tests/020.phpt --TEST-- CLI php --ri --SKIPIF-- <?php include "skipif.inc"; if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } ?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); echo `"$php" -n --ri this_extension_does_not_exist_568537753423`; echo `"$php" -n --ri standard`; echo "\nDone\n"; ?> --EXPECTF-- Extension 'this_extension_does_not_exist_568537753423' not present. standard %a Directive => Local Value => Master Value %a Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php