summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/TODO2
-rw-r--r--sapi/cli/cli.h4
-rw-r--r--sapi/cli/config.m413
-rw-r--r--sapi/cli/config.w321
-rw-r--r--sapi/cli/generate_mime_type_map.php3
-rw-r--r--sapi/cli/mime_type_map.h19
-rw-r--r--sapi/cli/php_cli.c40
-rw-r--r--sapi/cli/php_cli_process_title.c4
-rw-r--r--sapi/cli/php_cli_process_title.h2
-rw-r--r--sapi/cli/php_cli_server.c38
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/001.phpt2
-rw-r--r--sapi/cli/tests/002-win32.phpt6
-rw-r--r--sapi/cli/tests/002.phpt6
-rw-r--r--sapi/cli/tests/003-2.phpt6
-rw-r--r--sapi/cli/tests/003.phpt6
-rw-r--r--sapi/cli/tests/004.phpt7
-rw-r--r--sapi/cli/tests/005.phpt7
-rw-r--r--sapi/cli/tests/006.phpt42
-rw-r--r--sapi/cli/tests/007.phpt6
-rw-r--r--sapi/cli/tests/008.phpt6
-rw-r--r--sapi/cli/tests/009.phpt2
-rw-r--r--sapi/cli/tests/010-2.phpt6
-rw-r--r--sapi/cli/tests/010.phpt8
-rw-r--r--sapi/cli/tests/011.phpt2
-rw-r--r--sapi/cli/tests/012-2.phpt52
-rw-r--r--sapi/cli/tests/012.phpt2
-rw-r--r--sapi/cli/tests/013.phpt6
-rw-r--r--sapi/cli/tests/014.phpt2
-rw-r--r--sapi/cli/tests/015.phpt6
-rw-r--r--sapi/cli/tests/016.phpt8
-rw-r--r--sapi/cli/tests/017.phpt8
-rw-r--r--sapi/cli/tests/018.phpt8
-rw-r--r--sapi/cli/tests/019.phpt8
-rw-r--r--sapi/cli/tests/020.phpt6
-rw-r--r--sapi/cli/tests/021.phpt4
-rw-r--r--sapi/cli/tests/023.phpt2
-rw-r--r--sapi/cli/tests/argv_mb.phpt6
-rw-r--r--sapi/cli/tests/bug43177.phpt2
-rw-r--r--sapi/cli/tests/bug61679.phpt2
-rw-r--r--sapi/cli/tests/bug61977.phpt4
-rw-r--r--sapi/cli/tests/bug64544.phpt2
-rw-r--r--sapi/cli/tests/bug65066_100.phpt2
-rw-r--r--sapi/cli/tests/bug65066_422.phpt2
-rw-r--r--sapi/cli/tests/bug65066_511.phpt2
-rw-r--r--sapi/cli/tests/bug66606_1.phpt4
-rw-r--r--sapi/cli/tests/bug66606_2.phpt4
-rw-r--r--sapi/cli/tests/bug71005.phpt4
-rw-r--r--sapi/cli/tests/bug74600.phpt2
-rw-r--r--sapi/cli/tests/cli_get_process_title_basic.phpt18
-rw-r--r--sapi/cli/tests/cli_get_process_title_error.phpt16
-rw-r--r--sapi/cli/tests/cli_process_title_unix.phpt2
-rw-r--r--sapi/cli/tests/cli_process_title_windows.phpt2
-rw-r--r--sapi/cli/tests/cli_set_process_title_basic.phpt19
-rw-r--r--sapi/cli/tests/cli_set_process_title_error.phpt19
-rw-r--r--sapi/cli/tests/php_cli_server_001.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_002.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_003.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_004.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_005.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_006.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_007.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_008.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_009.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_010.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_012.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_013.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_015.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_016.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server_017.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_020.phpt4
73 files changed, 307 insertions, 209 deletions
diff --git a/sapi/cli/TODO b/sapi/cli/TODO
deleted file mode 100644
index 22e6689001..0000000000
--- a/sapi/cli/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-TODO:
-
diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h
index 0a76895c58..5cc39ff00b 100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.h
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
#ifndef CLI_H
#define CLI_H
@@ -30,7 +28,7 @@
#endif
-extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length);
+extern PHP_CLI_API ssize_t sapi_cli_single_write(const char *str, size_t str_length);
typedef struct {
size_t (*cli_shell_write)(const char *str, size_t str_length);
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 21681512a7..93c9e7b702 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -1,6 +1,4 @@
-dnl
-dnl $Id$
-dnl
+dnl config.m4 for sapi cli
PHP_ARG_ENABLE(cli,,
[ --disable-cli Disable building CLI version of PHP
@@ -11,12 +9,11 @@ AC_CHECK_FUNCS(setproctitle)
AC_CHECK_HEADERS([sys/pstat.h])
AC_CACHE_CHECK([for PS_STRINGS], [cli_cv_var_PS_STRINGS],
-[AC_TRY_LINK(
-[#include <machine/vmparam.h>
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <machine/vmparam.h>
#include <sys/exec.h>
-],
-[PS_STRINGS->ps_nargvstr = 1;
-PS_STRINGS->ps_argvstr = "foo";],
+]],
+[[PS_STRINGS->ps_nargvstr = 1;
+PS_STRINGS->ps_argvstr = "foo";]])],
[cli_cv_var_PS_STRINGS=yes],
[cli_cv_var_PS_STRINGS=no])])
if test "$cli_cv_var_PS_STRINGS" = yes ; then
diff --git a/sapi/cli/config.w32 b/sapi/cli/config.w32
index c510e231d1..155b2ce838 100644
--- a/sapi/cli/config.w32
+++ b/sapi/cli/config.w32
@@ -1,5 +1,4 @@
// vim:ft=javascript
-// $Id$
ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
ARG_ENABLE('crt-debug', 'Enable CRT memory dumps for debugging sent to STDERR', 'no');
diff --git a/sapi/cli/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index 13ae59dc0c..0cea031e37 100644
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -29,6 +29,7 @@ array_walk($types, function ($line) use (&$extensions) {
$additional_mime_maps = [
"map" => "application/json", // from commit: a0d62f08ae8cbebc88e5c92e08fca8d0cdc7309d
+ "jsm" => "application/javascript",
];
foreach($additional_mime_maps as $ext => $mime) {
@@ -69,7 +70,7 @@ typedef struct php_cli_server_ext_mime_type_pair {
const char *mime_type;
} php_cli_server_ext_mime_type_pair;
-static php_cli_server_ext_mime_type_pair mime_type_map[] = {
+static const php_cli_server_ext_mime_type_pair mime_type_map[] = {
<?php foreach ($extensions as $extension => $mime): ?>
{ "<?= addcslashes($extension, "\0..\37!@\@\177..\377") ?>", "<?= addcslashes($mime, "\0..\37!@\@\177..\377") ?>" },
<?php endforeach ?>
diff --git a/sapi/cli/mime_type_map.h b/sapi/cli/mime_type_map.h
index b937b6b96b..2b880b4c7f 100644
--- a/sapi/cli/mime_type_map.h
+++ b/sapi/cli/mime_type_map.h
@@ -27,7 +27,7 @@ typedef struct php_cli_server_ext_mime_type_pair {
const char *mime_type;
} php_cli_server_ext_mime_type_pair;
-static php_cli_server_ext_mime_type_pair mime_type_map[] = {
+static const php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "ez", "application/andrew-inset" },
{ "aw", "application/applixware" },
{ "atom", "application/atom+xml" },
@@ -635,16 +635,12 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "bdf", "application/x-font-bdf" },
{ "gsf", "application/x-font-ghostscript" },
{ "psf", "application/x-font-linux-psf" },
- { "otf", "application/x-font-otf" },
{ "pcf", "application/x-font-pcf" },
{ "snf", "application/x-font-snf" },
- { "ttf", "application/x-font-ttf" },
- { "ttc", "application/x-font-ttf" },
{ "pfa", "application/x-font-type1" },
{ "pfb", "application/x-font-type1" },
{ "pfm", "application/x-font-type1" },
{ "afm", "application/x-font-type1" },
- { "woff", "application/font-woff" },
{ "arc", "application/x-freearc" },
{ "spl", "application/x-futuresplash" },
{ "gca", "application/x-gca-compressed" },
@@ -758,6 +754,7 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "midi", "audio/midi" },
{ "kar", "audio/midi" },
{ "rmi", "audio/midi" },
+ { "m4a", "audio/mp4" },
{ "mp4a", "audio/mp4" },
{ "mpga", "audio/mpeg" },
{ "mp2", "audio/mpeg" },
@@ -804,6 +801,11 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "cml", "chemical/x-cml" },
{ "csml", "chemical/x-csml" },
{ "xyz", "chemical/x-xyz" },
+ { "ttc", "font/collection" },
+ { "otf", "font/otf" },
+ { "ttf", "font/ttf" },
+ { "woff", "font/woff" },
+ { "woff2", "font/woff2" },
{ "bmp", "image/bmp" },
{ "cgm", "image/cgm" },
{ "g3", "image/g3fax" },
@@ -825,9 +827,9 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "uvvi", "image/vnd.dece.graphic" },
{ "uvg", "image/vnd.dece.graphic" },
{ "uvvg", "image/vnd.dece.graphic" },
- { "sub", "text/vnd.dvb.subtitle" },
{ "djvu", "image/vnd.djvu" },
{ "djv", "image/vnd.djvu" },
+ { "sub", "text/vnd.dvb.subtitle" },
{ "dwg", "image/vnd.dwg" },
{ "dxf", "image/vnd.dxf" },
{ "fbs", "image/vnd.fastbidsheet" },
@@ -917,8 +919,8 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "vcard", "text/vcard" },
{ "curl", "text/vnd.curl" },
{ "dcurl", "text/vnd.curl.dcurl" },
- { "scurl", "text/vnd.curl.scurl" },
{ "mcurl", "text/vnd.curl.mcurl" },
+ { "scurl", "text/vnd.curl.scurl" },
{ "fly", "text/vnd.fly" },
{ "flx", "text/vnd.fmi.flexstor" },
{ "gv", "text/vnd.graphviz" },
@@ -941,10 +943,10 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "f77", "text/x-fortran" },
{ "f90", "text/x-fortran" },
{ "java", "text/x-java-source" },
+ { "nfo", "text/x-nfo" },
{ "opml", "text/x-opml" },
{ "p", "text/x-pascal" },
{ "pas", "text/x-pascal" },
- { "nfo", "text/x-nfo" },
{ "etx", "text/x-setext" },
{ "sfv", "text/x-sfv" },
{ "uu", "text/x-uuencode" },
@@ -1010,6 +1012,7 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] = {
{ "smv", "video/x-smv" },
{ "ice", "x-conference/x-cooltalk" },
{ "map", "application/json" },
+ { "jsm", "application/javascript" },
{ NULL, NULL }
};
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index b217b2731d..a36ea1893a 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -20,8 +20,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
#include "php.h"
#include "php_globals.h"
#include "php_variables.h"
@@ -267,13 +265,9 @@ static inline int sapi_cli_select(php_socket_t fd)
return ret != -1;
}
-PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /* {{{ */
+PHP_CLI_API ssize_t sapi_cli_single_write(const char *str, size_t str_length) /* {{{ */
{
-#ifdef PHP_WRITE_STDOUT
- zend_long ret;
-#else
- size_t ret;
-#endif
+ ssize_t ret;
if (cli_shell_callbacks.cli_shell_write) {
cli_shell_callbacks.cli_shell_write(str, str_length);
@@ -283,16 +277,10 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /*
do {
ret = write(STDOUT_FILENO, str, str_length);
} while (ret <= 0 && errno == EAGAIN && sapi_cli_select(STDOUT_FILENO));
-
- if (ret <= 0) {
- return 0;
- }
-
- return ret;
#else
ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
- return ret;
#endif
+ return ret;
}
/* }}} */
@@ -300,7 +288,7 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */
{
const char *ptr = str;
size_t remaining = str_length;
- size_t ret;
+ ssize_t ret;
if (!str_length) {
return 0;
@@ -317,8 +305,9 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */
while (remaining > 0)
{
ret = sapi_cli_single_write(ptr, remaining);
- if (!ret) {
+ if (ret < 0) {
#ifndef PHP_CLI_WIN32_NO_CONSOLE
+ EG(exit_status) = 255;
php_handle_aborted_connection();
#endif
break;
@@ -592,19 +581,16 @@ static void cli_register_file_handles(void) /* {{{ */
php_stream_to_zval(s_out, &oc.value);
php_stream_to_zval(s_err, &ec.value);
- ic.flags = CONST_CS;
- ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
- ic.module_number = 0;
+ ZEND_CONSTANT_SET_FLAGS(&ic, CONST_CS, 0);
+ ic.name = zend_string_init_interned("STDIN", sizeof("STDIN")-1, 0);
zend_register_constant(&ic);
- oc.flags = CONST_CS;
- oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
- oc.module_number = 0;
+ ZEND_CONSTANT_SET_FLAGS(&oc, CONST_CS, 0);
+ oc.name = zend_string_init_interned("STDOUT", sizeof("STDOUT")-1, 0);
zend_register_constant(&oc);
- ec.flags = CONST_CS;
- ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
- ec.module_number = 0;
+ ZEND_CONSTANT_SET_FLAGS(&ec, CONST_CS, 0);
+ ec.name = zend_string_init_interned("STDERR", sizeof("STDERR")-1, 0);
zend_register_constant(&ec);
}
/* }}} */
@@ -917,7 +903,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE) && (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE)
if (!interactive) {
/* The -a option was not passed. If there is no file, it could
- still make sense to run interactively. The presense of a file
+ still make sense to run interactively. The presence of a file
is essential to mitigate buggy console info. */
interactive = php_win32_console_is_own() &&
!(script_file ||
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index a24fbbb69e..a85370cbd5 100644
--- a/sapi/cli/php_cli_process_title.c
+++ b/sapi/cli/php_cli_process_title.c
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -26,7 +24,7 @@
#include "php_cli_process_title.h"
#include "ps_title.h"
-/* {{{ proto boolean cli_set_process_title(string arg)
+/* {{{ proto bool cli_set_process_title(string arg)
Return a boolean to confirm if the process title was successfully changed or not */
PHP_FUNCTION(cli_set_process_title)
{
diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
index 854dec6165..8882e3cd0e 100644
--- a/sapi/cli/php_cli_process_title.h
+++ b/sapi/cli/php_cli_process_title.h
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
#ifndef PHP_PS_TITLE_HEADER
#define PHP_PS_TITLE_HEADER
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 198afc8a6b..5386aa54c6 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -17,8 +17,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_cli.c 306938 2011-01-01 02:17:06Z felipe $ */
-
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -360,7 +358,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
smart_str_appendl_ex(buffer, "Date: ", 6, persistent);
smart_str_appends_ex(buffer, dt->val, persistent);
smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
- zend_string_release(dt);
+ zend_string_release_ex(dt, 0);
}
smart_str_appendl_ex(buffer, "Connection: close\r\n", sizeof("Connection: close\r\n") - 1, persistent);
@@ -1574,11 +1572,14 @@ static void php_cli_server_client_save_header(php_cli_server_client *client)
{
/* strip off the colon */
zend_string *orig_header_name = zend_string_init(client->current_header_name, client->current_header_name_len, 1);
- char *lc_header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len);
- zend_hash_str_add_ptr(&client->request.headers, lc_header_name, client->current_header_name_len, client->current_header_value);
+ zend_string *lc_header_name = zend_string_alloc(client->current_header_name_len, 1);
+ zend_str_tolower_copy(ZSTR_VAL(lc_header_name), client->current_header_name, client->current_header_name_len);
+ GC_MAKE_PERSISTENT_LOCAL(orig_header_name);
+ GC_MAKE_PERSISTENT_LOCAL(lc_header_name);
+ zend_hash_add_ptr(&client->request.headers, lc_header_name, client->current_header_value);
zend_hash_add_ptr(&client->request.headers_original_case, orig_header_name, client->current_header_value);
- efree(lc_header_name);
- zend_string_release(orig_header_name);
+ zend_string_release_ex(lc_header_name, 1);
+ zend_string_release_ex(orig_header_name, 1);
if (client->current_header_name_allocated) {
pefree(client->current_header_name, 1);
@@ -1832,7 +1833,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser
php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, NULL, 0);
client->addr_str = pestrndup(ZSTR_VAL(addr_str), ZSTR_LEN(addr_str), 1);
client->addr_str_len = ZSTR_LEN(addr_str);
- zend_string_release(addr_str);
+ zend_string_release_ex(addr_str, 0);
}
php_http_parser_init(&client->parser, PHP_HTTP_REQUEST);
client->request_read = 0;
@@ -1948,7 +1949,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s));
if (!chunk) {
- smart_str_free(&buffer);
+ smart_str_free_ex(&buffer, 1);
goto fail;
}
php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk);
@@ -2030,9 +2031,6 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
php_cli_server_chunk *chunk;
smart_str buffer = { 0 };
const char *mime_type = get_mime_type(server, client->request.ext, client->request.ext_len);
- if (!mime_type) {
- mime_type = "application/octet-stream";
- }
append_http_status_line(&buffer, client->request.protocol_version, status, 1);
if (!buffer.s) {
@@ -2041,19 +2039,21 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
return FAILURE;
}
append_essential_headers(&buffer, client, 1);
- smart_str_appendl_ex(&buffer, "Content-Type: ", sizeof("Content-Type: ") - 1, 1);
- smart_str_appends_ex(&buffer, mime_type, 1);
- if (strncmp(mime_type, "text/", 5) == 0) {
- smart_str_appends_ex(&buffer, "; charset=UTF-8", 1);
+ if (mime_type) {
+ smart_str_appendl_ex(&buffer, "Content-Type: ", sizeof("Content-Type: ") - 1, 1);
+ smart_str_appends_ex(&buffer, mime_type, 1);
+ if (strncmp(mime_type, "text/", 5) == 0) {
+ smart_str_appends_ex(&buffer, "; charset=UTF-8", 1);
+ }
+ smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
}
- smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
smart_str_appends_ex(&buffer, "Content-Length: ", 1);
smart_str_append_unsigned_ex(&buffer, client->request.sb.st_size, 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s));
if (!chunk) {
- smart_str_free(&buffer);
+ smart_str_free_ex(&buffer, 1);
php_cli_server_log_response(client, 500, NULL);
return FAILURE;
}
@@ -2289,7 +2289,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c
if (server_sock == SOCK_ERR) {
php_cli_server_logf("Failed to listen on %s:%d (reason: %s)", host, port, errstr ? ZSTR_VAL(errstr) : "?");
if (errstr) {
- zend_string_release(errstr);
+ zend_string_release_ex(errstr, 0);
}
retval = FAILURE;
goto out;
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index e6d528cedb..2a68894479 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_cli.c 306938 2011-01-01 02:17:06Z felipe $ */
-
#ifndef PHP_CLI_SERVER_H
#define PHP_CLI_SERVER_H
diff --git a/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
index 69e791061c..bc18470ce1 100644
--- a/sapi/cli/ps_title.h
+++ b/sapi/cli/ps_title.h
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
#ifndef PS_TITLE_HEADER
#define PS_TITLE_HEADER
diff --git a/sapi/cli/tests/001.phpt b/sapi/cli/tests/001.phpt
index 744918a373..6fbd608a6f 100644
--- a/sapi/cli/tests/001.phpt
+++ b/sapi/cli/tests/001.phpt
@@ -11,7 +11,7 @@ var_dump(`$php -n -v`);
echo "Done\n";
?>
---EXPECTF--
+--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
diff --git a/sapi/cli/tests/002-win32.phpt b/sapi/cli/tests/002-win32.phpt
index d65961de8e..6176625c5b 100644
--- a/sapi/cli/tests/002-win32.phpt
+++ b/sapi/cli/tests/002-win32.phpt
@@ -1,8 +1,8 @@
--TEST--
running code with -r
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) != 'WIN') {
die ("skip only for Windows");
}
@@ -16,7 +16,7 @@ var_dump(`$php -n -r "var_dump('hello');"`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(18) "string(5) "hello"
"
Done
diff --git a/sapi/cli/tests/002.phpt b/sapi/cli/tests/002.phpt
index f273aa02d3..c67b93eba2 100644
--- a/sapi/cli/tests/002.phpt
+++ b/sapi/cli/tests/002.phpt
@@ -1,8 +1,8 @@
--TEST--
running code with -r
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -16,7 +16,7 @@ var_dump(`$php -n -r 'var_dump("hello");'`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(18) "string(5) "hello"
"
Done
diff --git a/sapi/cli/tests/003-2.phpt b/sapi/cli/tests/003-2.phpt
index b3fd78233e..24c3b591cc 100644
--- a/sapi/cli/tests/003-2.phpt
+++ b/sapi/cli/tests/003-2.phpt
@@ -1,8 +1,8 @@
--TEST--
defining INI options with -d (as 2nd arg)
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -17,7 +17,7 @@ var_dump(`"$php" -nd max_execution_time=500 -r 'var_dump(ini_get("max_execution_
?>
===DONE===
---EXPECTF--
+--EXPECT--
string(16) "string(3) "111"
"
string(16) "string(3) "500"
diff --git a/sapi/cli/tests/003.phpt b/sapi/cli/tests/003.phpt
index cbba356fd3..aff5a845b8 100644
--- a/sapi/cli/tests/003.phpt
+++ b/sapi/cli/tests/003.phpt
@@ -1,8 +1,8 @@
--TEST--
defining INI options with -d
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -19,7 +19,7 @@ var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 -r 'var
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(16) "string(3) "111"
"
string(16) "string(3) "500"
diff --git a/sapi/cli/tests/004.phpt b/sapi/cli/tests/004.phpt
index 3123d0dc77..1a5473987f 100644
--- a/sapi/cli/tests/004.phpt
+++ b/sapi/cli/tests/004.phpt
@@ -2,10 +2,7 @@
show information about function
--SKIPIF--
<?php
-include "skipif.inc";
-if (!extension_loaded("reflection")) {
- die("skip reflection extension required");
-}
+include "skipif.inc";
?>
--FILE--
<?php
@@ -18,7 +15,7 @@ var_dump(`$php -n --rf phpinfo`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(45) "Exception: Function unknown() does not exist
"
string(42) "Exception: Function echo() does not exist
diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 3dd937b55e..2a4b8d955d 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -2,10 +2,7 @@
show information about class
--SKIPIF--
<?php
-include "skipif.inc";
-if (!extension_loaded("reflection")) {
- die("skip reflection extension required");
-}
+include "skipif.inc";
?>
--FILE--
<?php
@@ -18,7 +15,7 @@ var_dump(`"$php" -n --rc exception`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(40) "Exception: Class unknown does not exist
"
string(183) "Class [ <internal:Core> class stdClass ] {
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index a4ac0ca4cf..6a980b8c45 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -3,8 +3,11 @@ show information about extension
--SKIPIF--
<?php
include "skipif.inc";
-if (!extension_loaded("reflection") || !extension_loaded("session")) {
- die("skip reflection and session extensions required");
+if (!extension_loaded("session")) {
+ die("skip session extension required");
+}
+if (PCRE_JIT_SUPPORT == false) {
+ die ("skip not pcre jit support builtin");
}
?>
--INI--
@@ -39,23 +42,26 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
}
}
- - Constants [16] {
- Constant [ integer PREG_PATTERN_ORDER ] { 1 }
- Constant [ integer PREG_SET_ORDER ] { 2 }
- Constant [ integer PREG_OFFSET_CAPTURE ] { 256 }
- Constant [ integer PREG_UNMATCHED_AS_NULL ] { 512 }
- 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 [ integer PREG_JIT_STACKLIMIT_ERROR ] { 6 }
+ - Constants [19] {
+ Constant [ int PREG_PATTERN_ORDER ] { 1 }
+ Constant [ int PREG_SET_ORDER ] { 2 }
+ Constant [ int PREG_OFFSET_CAPTURE ] { 256 }
+ Constant [ int PREG_UNMATCHED_AS_NULL ] { 512 }
+ Constant [ int PREG_SPLIT_NO_EMPTY ] { 1 }
+ Constant [ int PREG_SPLIT_DELIM_CAPTURE ] { 2 }
+ Constant [ int PREG_SPLIT_OFFSET_CAPTURE ] { 4 }
+ Constant [ int PREG_GREP_INVERT ] { 1 }
+ Constant [ int PREG_NO_ERROR ] { 0 }
+ Constant [ int PREG_INTERNAL_ERROR ] { 1 }
+ Constant [ int PREG_BACKTRACK_LIMIT_ERROR ] { 2 }
+ Constant [ int PREG_RECURSION_LIMIT_ERROR ] { 3 }
+ Constant [ int PREG_BAD_UTF8_ERROR ] { 4 }
+ Constant [ int PREG_BAD_UTF8_OFFSET_ERROR ] { 5 }
+ Constant [ int PREG_JIT_STACKLIMIT_ERROR ] { 6 }
Constant [ string PCRE_VERSION ] { %s }
+ Constant [ int PCRE_VERSION_MAJOR ] { %d }
+ Constant [ int PCRE_VERSION_MINOR ] { %d }
+ Constant [ bool PCRE_JIT_SUPPORT ] { %d }
}
- Functions {
diff --git a/sapi/cli/tests/007.phpt b/sapi/cli/tests/007.phpt
index d1af19f1d2..d50c38149a 100644
--- a/sapi/cli/tests/007.phpt
+++ b/sapi/cli/tests/007.phpt
@@ -1,8 +1,8 @@
--TEST--
strip comments and whitespace with -w
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -40,7 +40,7 @@ var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo()
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(81) "
<?php
class test { public $var = "test"; private $pri; function foo() { } } ?>
diff --git a/sapi/cli/tests/008.phpt b/sapi/cli/tests/008.phpt
index 429254f4d6..0121d94a27 100644
--- a/sapi/cli/tests/008.phpt
+++ b/sapi/cli/tests/008.phpt
@@ -1,8 +1,8 @@
--TEST--
execute a file with -f
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -33,7 +33,7 @@ var_dump(`$php -n -f "wrong"`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
string(%d) "
Fatal error: Uncaught Error: Cannot access private property test::$pri in %s:%d
diff --git a/sapi/cli/tests/009.phpt b/sapi/cli/tests/009.phpt
index 54c795b0f6..5e72e39f03 100644
--- a/sapi/cli/tests/009.phpt
+++ b/sapi/cli/tests/009.phpt
@@ -12,7 +12,7 @@ var_dump(`$php -n -r "echo hello;" -a`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
diff --git a/sapi/cli/tests/010-2.phpt b/sapi/cli/tests/010-2.phpt
index 57e0f7a47c..cec29c6b4a 100644
--- a/sapi/cli/tests/010-2.phpt
+++ b/sapi/cli/tests/010-2.phpt
@@ -1,8 +1,8 @@
--TEST--
executing a code with -R
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -27,7 +27,7 @@ var_dump(`cat "$filename_txt" | "$php" -n -R "var_dump(1);"`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(21) "int(1)
int(1)
int(1)
diff --git a/sapi/cli/tests/010.phpt b/sapi/cli/tests/010.phpt
index 2c3da0eb41..198eef4bed 100644
--- a/sapi/cli/tests/010.phpt
+++ b/sapi/cli/tests/010.phpt
@@ -1,8 +1,8 @@
--TEST--
-executing a file with -F
+executing a file with -F
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -38,7 +38,7 @@ var_dump(`cat "$filename_txt" | "$php" -n -F "$filename"`);
@unlink(__DIR__."/010.test.php");
@unlink(__DIR__."/010.test.txt");
?>
---EXPECTF--
+--EXPECT--
string(25) "
string(10) "test
hello"
diff --git a/sapi/cli/tests/011.phpt b/sapi/cli/tests/011.phpt
index 1fbe93d703..6154693517 100644
--- a/sapi/cli/tests/011.phpt
+++ b/sapi/cli/tests/011.phpt
@@ -46,7 +46,7 @@ var_dump(`"$php" -n -l $filename`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
string(%d) "No syntax errors detected in %s011.test.php
"
string(40) "Could not open input file: some.unknown
diff --git a/sapi/cli/tests/012-2.phpt b/sapi/cli/tests/012-2.phpt
new file mode 100644
index 0000000000..da73fa9b26
--- /dev/null
+++ b/sapi/cli/tests/012-2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+more invalid arguments and error messages
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+
+// -r : behavior = CLI_DIRECT
+// -F / -R / -B / -E : behavior = PROCESS_STDIN
+// -l : behavior = LINT
+// -s : behavior = HIGHLIGHT
+// -w : behavior = STRIP
+
+var_dump(`"$php" -n -r "echo 1;" -F some.php`);
+var_dump(`"$php" -n -r "echo 2;" -f some.php`);
+var_dump(`"$php" -n -r "echo 3;" -l`); // ignores linting
+var_dump(`"$php" -n -r "echo 4;" -R some.php`);
+var_dump(`"$php" -n -r "echo 5;" -B ""`);
+var_dump(`"$php" -n -a -B ""`);
+var_dump(`"$php" -n -r "echo 6;" -E ""`);
+var_dump(`"$php" -n -a -E ""`);
+var_dump(`"$php" -n -r "echo 7;" -s`);
+var_dump(`"$php" -n -r "echo 8;" -w`);
+var_dump(`"$php" -n -l -r "echo 9;"`);
+
+echo "Done\n";
+?>
+--EXPECT--
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(1) "3"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+string(42) "Source highlighting only works for files.
+"
+string(39) "Source stripping only works for files.
+"
+string(57) "Either execute direct code, process stdin or use a file.
+"
+Done
diff --git a/sapi/cli/tests/012.phpt b/sapi/cli/tests/012.phpt
index 780e1088d0..90527143e5 100644
--- a/sapi/cli/tests/012.phpt
+++ b/sapi/cli/tests/012.phpt
@@ -18,7 +18,7 @@ var_dump(`"$php" -n -r '' -r ''`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(32) "You can use -R or -F only once.
"
string(32) "You can use -R or -F only once.
diff --git a/sapi/cli/tests/013.phpt b/sapi/cli/tests/013.phpt
index 6d49789382..af5a82ecd7 100644
--- a/sapi/cli/tests/013.phpt
+++ b/sapi/cli/tests/013.phpt
@@ -1,8 +1,8 @@
--TEST--
running PHP code before and after processing input lines with -B and -E
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -23,7 +23,7 @@ var_dump(`cat "$filename_txt" | "$php" -n -B 'var_dump("start");' -E 'var_dump("
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(18) "string(5) "start"
"
string(16) "string(3) "end"
diff --git a/sapi/cli/tests/014.phpt b/sapi/cli/tests/014.phpt
index 572c9e78cd..84c6d16204 100644
--- a/sapi/cli/tests/014.phpt
+++ b/sapi/cli/tests/014.phpt
@@ -34,7 +34,7 @@ var_dump(`"$php" -n -s unknown`);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1478) "<code><span style="color: #000000">
<br /><span style="color: #0000BB">&lt;?php<br />$test&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"var"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//var<br />/*&nbsp;test&nbsp;class&nbsp;*/<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test&nbsp;$arg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">$o&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>
</span>
diff --git a/sapi/cli/tests/015.phpt b/sapi/cli/tests/015.phpt
index 01f5328e99..62a007b6e4 100644
--- a/sapi/cli/tests/015.phpt
+++ b/sapi/cli/tests/015.phpt
@@ -1,8 +1,8 @@
--TEST--
CLI long options
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -20,7 +20,7 @@ echo `"$php" -n --notexisting foo bar baz | grep Usage:`;
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
PHP %d.%d.%d%s(cli) (built: %s)%s
Array
(
diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt
index cf9ff8c9d3..cbedb1e7ac 100644
--- a/sapi/cli/tests/016.phpt
+++ b/sapi/cli/tests/016.phpt
@@ -1,8 +1,8 @@
--TEST--
-CLI -a and readline
+CLI -a and readline
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (!extension_loaded('readline') || readline_info('done') === NULL) {
die ("skip need readline support");
}
@@ -59,7 +59,7 @@ foreach ($codes as $key => $code) {
echo "\nDone\n";
?>
---EXPECTF--
+--EXPECT--
--------------
Snippet no. 1:
--------------
diff --git a/sapi/cli/tests/017.phpt b/sapi/cli/tests/017.phpt
index cd1a1adfdc..a19d0a6bd3 100644
--- a/sapi/cli/tests/017.phpt
+++ b/sapi/cli/tests/017.phpt
@@ -1,8 +1,8 @@
--TEST--
-CLI -a and libedit
+CLI -a and libedit
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (!extension_loaded('readline') || readline_info('done') !== NULL) {
die ("skip need readline support using libedit");
}
@@ -59,7 +59,7 @@ foreach ($codes as $key => $code) {
echo "\nDone\n";
?>
---EXPECTF--
+--EXPECT--
--------------
Snippet no. 1:
--------------
diff --git a/sapi/cli/tests/018.phpt b/sapi/cli/tests/018.phpt
index 9ebe4faa87..56921bd669 100644
--- a/sapi/cli/tests/018.phpt
+++ b/sapi/cli/tests/018.phpt
@@ -1,8 +1,8 @@
--TEST--
-CLI php -m
+CLI php -m
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -17,7 +17,7 @@ echo `"$php" -n -m`;
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
[PHP Modules]
%a
pcre
diff --git a/sapi/cli/tests/019.phpt b/sapi/cli/tests/019.phpt
index 2b8c0f007e..c98155d8d5 100644
--- a/sapi/cli/tests/019.phpt
+++ b/sapi/cli/tests/019.phpt
@@ -1,8 +1,8 @@
--TEST--
-CLI php -i
+CLI php -i
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
@@ -17,7 +17,7 @@ echo `"$php" -n -i`;
echo "\nDone\n";
?>
---EXPECTF--
+--EXPECTF--
phpinfo()
PHP Version => %s
%a
diff --git a/sapi/cli/tests/020.phpt b/sapi/cli/tests/020.phpt
index ac23e77f6a..62be4ba31a 100644
--- a/sapi/cli/tests/020.phpt
+++ b/sapi/cli/tests/020.phpt
@@ -1,8 +1,8 @@
--TEST--
-CLI php --ri
+CLI php --ri
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
diff --git a/sapi/cli/tests/021.phpt b/sapi/cli/tests/021.phpt
index 0edd5a81c0..cd27715334 100644
--- a/sapi/cli/tests/021.phpt
+++ b/sapi/cli/tests/021.phpt
@@ -1,7 +1,7 @@
--TEST--
CLI shell shebang
--SKIPIF--
-<?php
+<?php
include 'skipif.inc';
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
@@ -35,7 +35,7 @@ echo "\nDone\n";
<?php
unlink(__DIR__.'/021.tmp.php');
?>
---EXPECTF--
+--EXPECT--
ola
2
adeus
diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt
index 91674e321e..09b256a9af 100644
--- a/sapi/cli/tests/023.phpt
+++ b/sapi/cli/tests/023.phpt
@@ -41,6 +41,6 @@ proc_close($proc);
<?php
unlink(__DIR__ . "/023.ini");
?>
---EXPECTF--
+--EXPECT--
string(3) "40M"
string(0) ""
diff --git a/sapi/cli/tests/argv_mb.phpt b/sapi/cli/tests/argv_mb.phpt
index 2e14b1a192..e8c47f0972 100644
--- a/sapi/cli/tests/argv_mb.phpt
+++ b/sapi/cli/tests/argv_mb.phpt
@@ -1,8 +1,8 @@
--TEST--
Test basic argv multibyte API integration
--SKIPIF--
-<?php
-include "skipif.inc";
+<?php
+include "skipif.inc";
if (substr(PHP_OS, 0, 3) != 'WIN') {
die ("skip only for Windows");
}
@@ -21,7 +21,7 @@ var_dump(`$php -n $argv_fl 多字节字符串 マルチバイト文字列 мно
?>
==DONE==
---EXPECTF--
+--EXPECTF--
string(%d) "array(%d) {
[0]=>
string(%d) "%sargv_test.php"
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt
index 87dc8927ff..e475fb09b4 100644
--- a/sapi/cli/tests/bug43177.phpt
+++ b/sapi/cli/tests/bug43177.phpt
@@ -2,7 +2,7 @@
Bug #61977 Test exit code for various errors
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/bug61679.phpt b/sapi/cli/tests/bug61679.phpt
index 819ce2fa89..3ba36d572c 100644
--- a/sapi/cli/tests/bug61679.phpt
+++ b/sapi/cli/tests/bug61679.phpt
@@ -39,5 +39,5 @@ HEADER
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
HTTP/1.1 501 Not Implemented
diff --git a/sapi/cli/tests/bug61977.phpt b/sapi/cli/tests/bug61977.phpt
index 604c9babe6..b23f0e28f6 100644
--- a/sapi/cli/tests/bug61977.phpt
+++ b/sapi/cli/tests/bug61977.phpt
@@ -2,7 +2,7 @@
Bug #61977 test CLI web-server support for Mime Type File extensions mapping
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -43,7 +43,7 @@ HEADER;
test_mimetypes($mimetypes);
?>
---EXPECTF--
+--EXPECT--
foo.html => Content-Type: text/html; charset=UTF-8
foo.htm => Content-Type: text/html; charset=UTF-8
foo.svg => Content-Type: image/svg+xml
diff --git a/sapi/cli/tests/bug64544.phpt b/sapi/cli/tests/bug64544.phpt
index cc49545c16..33a6e16a10 100644
--- a/sapi/cli/tests/bug64544.phpt
+++ b/sapi/cli/tests/bug64544.phpt
@@ -15,6 +15,6 @@ var_dump(getenv("HOME"));
putenv("FOO=BAR");
var_dump(getenv("FOO"));
?>
---EXPECTF--
+--EXPECT--
string(4) "/tmp"
string(3) "BAR"
diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt
index 4203b7444c..34381d8e96 100644
--- a/sapi/cli/tests/bug65066_100.phpt
+++ b/sapi/cli/tests/bug65066_100.phpt
@@ -4,7 +4,7 @@ Bug #65066 (Cli server not responsive when responding with 422 http status code)
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt
index e8b497e923..f25ddfbca6 100644
--- a/sapi/cli/tests/bug65066_422.phpt
+++ b/sapi/cli/tests/bug65066_422.phpt
@@ -4,7 +4,7 @@ Bug #65066 (Cli server not responsive when responding with 422 http status code)
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt
index 7e5548aadc..27c9f9755a 100644
--- a/sapi/cli/tests/bug65066_511.phpt
+++ b/sapi/cli/tests/bug65066_511.phpt
@@ -4,7 +4,7 @@ Bug #65066 (Cli server not responsive when responding with 422 http status code)
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/bug66606_1.phpt b/sapi/cli/tests/bug66606_1.phpt
index 6b1b82772f..3cda764e61 100644
--- a/sapi/cli/tests/bug66606_1.phpt
+++ b/sapi/cli/tests/bug66606_1.phpt
@@ -4,7 +4,7 @@ Bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE) - GET request
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -12,6 +12,6 @@ include "php_cli_server.inc";
php_cli_server_start('var_dump($_SERVER["CONTENT_TYPE"], $_SERVER["CONTENT_LENGTH"])');
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS);
?>
---EXPECTF--
+--EXPECT--
NULL
NULL
diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt
index d8bd6162a4..c47b7736c0 100644
--- a/sapi/cli/tests/bug66606_2.phpt
+++ b/sapi/cli/tests/bug66606_2.phpt
@@ -4,7 +4,7 @@ Bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE) - POST request
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -35,7 +35,7 @@ HEADER
fclose($fp);
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
diff --git a/sapi/cli/tests/bug71005.phpt b/sapi/cli/tests/bug71005.phpt
index 6a163d4639..f02f261fbf 100644
--- a/sapi/cli/tests/bug71005.phpt
+++ b/sapi/cli/tests/bug71005.phpt
@@ -2,7 +2,7 @@
Bug #71005 (Segfault in php_cli_server_dispatch_router())
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -36,7 +36,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
diff --git a/sapi/cli/tests/bug74600.phpt b/sapi/cli/tests/bug74600.phpt
index 0ca7be95a7..eee222aaa3 100644
--- a/sapi/cli/tests/bug74600.phpt
+++ b/sapi/cli/tests/bug74600.phpt
@@ -33,6 +33,6 @@ proc_close($proc);
<?php
unlink(__DIR__ . "/bug74600.ini");
?>
---EXPECTF--
+--EXPECT--
string(4) "okey"
string(0) ""
diff --git a/sapi/cli/tests/cli_get_process_title_basic.phpt b/sapi/cli/tests/cli_get_process_title_basic.phpt
new file mode 100644
index 0000000000..66d1d4f3a7
--- /dev/null
+++ b/sapi/cli/tests/cli_get_process_title_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+cli_get_process_title() function : basic functionality
+--CREDITS--
+Patrick Allaert patrickallaert@php.net
+@nephp #nephp17
+--SKIPIF--
+<?php
+if (PHP_SAPI !== "cli")
+ die("skip");
+?>
+--FILE--
+<?php
+if (cli_set_process_title("title") && cli_get_process_title() === "title")
+ echo "Title correctly retrieved!\n";
+
+?>
+--EXPECT--
+Title correctly retrieved!
diff --git a/sapi/cli/tests/cli_get_process_title_error.phpt b/sapi/cli/tests/cli_get_process_title_error.phpt
new file mode 100644
index 0000000000..67274db26c
--- /dev/null
+++ b/sapi/cli/tests/cli_get_process_title_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+cli_get_process_title() function : error conditions
+--CREDITS--
+Patrick Allaert patrickallaert@php.net
+@nephp #nephp17
+--SKIPIF--
+<?php
+if (PHP_SAPI !== "cli")
+ die("skip");
+?>
+--FILE--
+<?php
+cli_get_process_title("foo");
+?>
+--EXPECTF--
+Warning: cli_get_process_title() expects exactly 0 parameters, 1 given in %scli_get_process_title_error.php on line 2
diff --git a/sapi/cli/tests/cli_process_title_unix.phpt b/sapi/cli/tests/cli_process_title_unix.phpt
index 659299c1fc..418433d8f2 100644
--- a/sapi/cli/tests/cli_process_title_unix.phpt
+++ b/sapi/cli/tests/cli_process_title_unix.phpt
@@ -47,7 +47,7 @@ else
echo "Actually loaded from get: $read_title\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing setting the process title ***
Successfully set title
Successfully verified title using ps
diff --git a/sapi/cli/tests/cli_process_title_windows.phpt b/sapi/cli/tests/cli_process_title_windows.phpt
index 91bac579e8..677f43fd8b 100644
--- a/sapi/cli/tests/cli_process_title_windows.phpt
+++ b/sapi/cli/tests/cli_process_title_windows.phpt
@@ -66,7 +66,7 @@ else
echo "Actually loaded from get: $read_title\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing setting the process title ***
Successfully set title
Successfully verified title using get-process
diff --git a/sapi/cli/tests/cli_set_process_title_basic.phpt b/sapi/cli/tests/cli_set_process_title_basic.phpt
new file mode 100644
index 0000000000..9899f3456b
--- /dev/null
+++ b/sapi/cli/tests/cli_set_process_title_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+cli_set_process_title() function : basic functionality
+--CREDITS--
+Patrick Allaert patrickallaert@php.net
+@nephp #nephp17
+--SKIPIF--
+<?php
+if (PHP_SAPI !== "cli")
+ die("skip");
+?>
+--FILE--
+<?php
+if (cli_set_process_title("title") === true &&
+ cli_get_process_title() === "title")
+ echo "Successfully set title\n";
+
+?>
+--EXPECT--
+Successfully set title
diff --git a/sapi/cli/tests/cli_set_process_title_error.phpt b/sapi/cli/tests/cli_set_process_title_error.phpt
new file mode 100644
index 0000000000..025c73015b
--- /dev/null
+++ b/sapi/cli/tests/cli_set_process_title_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+cli_set_process_title() function : error conditions
+--CREDITS--
+Patrick Allaert patrickallaert@php.net
+@nephp #nephp17
+--SKIPIF--
+<?php
+if (PHP_SAPI !== "cli")
+ die("skip");
+?>
+--FILE--
+<?php
+cli_set_process_title();
+cli_set_process_title("foo", "bar");
+?>
+--EXPECTF--
+Warning: cli_set_process_title() expects exactly 1 parameter, 0 given in %scli_set_process_title_error.php on line 2
+
+Warning: cli_set_process_title() expects exactly 1 parameter, 2 given in %scli_set_process_title_error.php on line 3
diff --git a/sapi/cli/tests/php_cli_server_001.phpt b/sapi/cli/tests/php_cli_server_001.phpt
index c2ed8ddff1..3f1083e7ac 100644
--- a/sapi/cli/tests/php_cli_server_001.phpt
+++ b/sapi/cli/tests/php_cli_server_001.phpt
@@ -4,7 +4,7 @@ basic function
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_002.phpt b/sapi/cli/tests/php_cli_server_002.phpt
index e1fbd90398..93151c15d4 100644
--- a/sapi/cli/tests/php_cli_server_002.phpt
+++ b/sapi/cli/tests/php_cli_server_002.phpt
@@ -4,7 +4,7 @@ $_SERVER variable
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -12,7 +12,7 @@ include "php_cli_server.inc";
php_cli_server_start('var_dump($_SERVER["DOCUMENT_ROOT"], $_SERVER["SERVER_SOFTWARE"], $_SERVER["SERVER_NAME"], $_SERVER["SERVER_PORT"]);');
var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS));
?>
---EXPECTF--
+--EXPECTF--
string(%d) "string(%d) "%stests"
string(%d) "PHP %s Development Server"
string(%d) "localhost"
diff --git a/sapi/cli/tests/php_cli_server_003.phpt b/sapi/cli/tests/php_cli_server_003.phpt
index e763c7ac34..d8fb8461be 100644
--- a/sapi/cli/tests/php_cli_server_003.phpt
+++ b/sapi/cli/tests/php_cli_server_003.phpt
@@ -4,7 +4,7 @@ Bug #55726 (Changing the working directory makes router script inaccessible)
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -13,6 +13,6 @@ php_cli_server_start('chdir(__DIR__); echo "okey";');
var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS));
var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS));
?>
---EXPECTF--
+--EXPECT--
string(4) "okey"
string(4) "okey"
diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt
index 9c93de3f92..5e3bbec18f 100644
--- a/sapi/cli/tests/php_cli_server_004.phpt
+++ b/sapi/cli/tests/php_cli_server_004.phpt
@@ -4,7 +4,7 @@ Bug #55747 (request headers missed in $_SERVER)
allow_url_fopen=1
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -35,7 +35,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt
index f89245df11..3f9078c8ae 100644
--- a/sapi/cli/tests/php_cli_server_005.phpt
+++ b/sapi/cli/tests/php_cli_server_005.phpt
@@ -2,7 +2,7 @@
Post a file
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -47,7 +47,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt
index ee851b0edd..c68f1e51b0 100644
--- a/sapi/cli/tests/php_cli_server_006.phpt
+++ b/sapi/cli/tests/php_cli_server_006.phpt
@@ -2,7 +2,7 @@
Bug #55755 (SegFault when outputting header WWW-Authenticate)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -31,7 +31,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt
index 3e8fc5f48d..b588b9ee2e 100644
--- a/sapi/cli/tests/php_cli_server_007.phpt
+++ b/sapi/cli/tests/php_cli_server_007.phpt
@@ -2,7 +2,7 @@
Bug #55758 (Digest Authenticate missed in 5.4)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -31,7 +31,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 401 Unauthorized
Host: %s
Date: %s
diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt
index 2d9955c031..58b2485db5 100644
--- a/sapi/cli/tests/php_cli_server_008.phpt
+++ b/sapi/cli/tests/php_cli_server_008.phpt
@@ -2,7 +2,7 @@
SERVER_PROTOCOL header availability
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt
index cb4a14cb08..d63c6abf28 100644
--- a/sapi/cli/tests/php_cli_server_009.phpt
+++ b/sapi/cli/tests/php_cli_server_009.phpt
@@ -5,7 +5,7 @@ After this fix(#60112), previously 404 request like "localhost/foo/bar"
now could serve correctly with request_uri "index.php" and PATH_INFO "/foo/bar/"
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt
index 22cf3de344..fe8f1a98ca 100644
--- a/sapi/cli/tests/php_cli_server_010.phpt
+++ b/sapi/cli/tests/php_cli_server_010.phpt
@@ -2,7 +2,7 @@
Bug #60180 ($_SERVER["PHP_SELF"] incorrect)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt
index d60d71b02a..10b9cdbfe9 100644
--- a/sapi/cli/tests/php_cli_server_012.phpt
+++ b/sapi/cli/tests/php_cli_server_012.phpt
@@ -2,7 +2,7 @@
Bug #60159 (Router returns false, but POST is not passed to requested resource)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt
index cfed0c5531..23269580fb 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -2,7 +2,7 @@
No router, no script
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 7210321925..f308ffb226 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -2,7 +2,7 @@
Bug #60477: Segfault after two multipart/form-data POST requestes
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt
index 42000adbb9..663268aea6 100644
--- a/sapi/cli/tests/php_cli_server_015.phpt
+++ b/sapi/cli/tests/php_cli_server_015.phpt
@@ -2,7 +2,7 @@
Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--INI--
display_errors=1
diff --git a/sapi/cli/tests/php_cli_server_016.phpt b/sapi/cli/tests/php_cli_server_016.phpt
index 855acd5ec3..513d7ec027 100644
--- a/sapi/cli/tests/php_cli_server_016.phpt
+++ b/sapi/cli/tests/php_cli_server_016.phpt
@@ -5,7 +5,7 @@ this is an indirect test for bug 60591, since mem leak is reproted in the server
and require php compiled with --enable-debug
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -42,5 +42,5 @@ HEADER
fclose($fp);
?>
---EXPECTF--
+--EXPECT--
HTTP/1.1 404 Not Found
diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt
index 067d504800..28876dc52b 100644
--- a/sapi/cli/tests/php_cli_server_017.phpt
+++ b/sapi/cli/tests/php_cli_server_017.phpt
@@ -2,7 +2,7 @@
Implement Req #60850 (Built in web server does not set $_SERVER['SCRIPT_FILENAME'] when using router)
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
diff --git a/sapi/cli/tests/php_cli_server_020.phpt b/sapi/cli/tests/php_cli_server_020.phpt
index 23a8bc40e1..766c666911 100644
--- a/sapi/cli/tests/php_cli_server_020.phpt
+++ b/sapi/cli/tests/php_cli_server_020.phpt
@@ -2,7 +2,7 @@
Use SEARCH as a HTTP verb
--SKIPIF--
<?php
-include "skipif.inc";
+include "skipif.inc";
?>
--FILE--
<?php
@@ -30,7 +30,7 @@ HEADER
}
?>
---EXPECTF--
+--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s