summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/apache2handler/config.m47
-rwxr-xr-xsapi/cgi/CHANGES33
-rw-r--r--sapi/cgi/cgi_main.c30
-rw-r--r--sapi/cli/TODO2
-rw-r--r--sapi/cli/php_cli.c6
-rw-r--r--sapi/cli/php_cli_server.c9
-rw-r--r--sapi/cli/tests/006.phpt8
-rw-r--r--sapi/cli/tests/012-2.phpt52
-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_set_process_title_basic.phpt19
-rw-r--r--sapi/cli/tests/cli_set_process_title_error.phpt19
-rw-r--r--sapi/fpm/.gitignore4
-rw-r--r--sapi/fpm/fpm/fpm_main.c25
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c2
-rw-r--r--sapi/fpm/fpm/fpm_status.c30
-rw-r--r--sapi/litespeed/lsapi_main.c10
-rw-r--r--sapi/phpdbg/.gitignore6
-rw-r--r--sapi/phpdbg/.travis.yml11
-rw-r--r--sapi/phpdbg/README.md2
-rw-r--r--sapi/phpdbg/config.m41
-rw-r--r--sapi/phpdbg/phpdbg.c28
-rw-r--r--sapi/phpdbg/phpdbg.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c6
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c8
-rw-r--r--sapi/phpdbg/phpdbg_out.h17
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c18
-rw-r--r--sapi/phpdbg/phpdbg_utils.c36
-rw-r--r--sapi/phpdbg/phpdbg_watch.c1
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.h2
-rw-r--r--sapi/phpdbg/tests/run_001.phpt2
-rwxr-xr-xsapi/phpdbg/travis/ci.sh11
34 files changed, 272 insertions, 173 deletions
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 2e64b215e5..3176700287 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -103,13 +103,6 @@ if test "$PHP_APXS2" != "no"; then
SAPI_SHARED=libs/libphp7.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
- *beos*)
- if test -f _APP_; then `rm _APP_`; fi
- `ln -s $APXS_BINDIR/httpd _APP_`
- EXTRA_LIBS="$EXTRA_LIBS _APP_"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
- ;;
*)
PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
diff --git a/sapi/cgi/CHANGES b/sapi/cgi/CHANGES
deleted file mode 100755
index b7cf41cf5e..0000000000
--- a/sapi/cgi/CHANGES
+++ /dev/null
@@ -1,33 +0,0 @@
-In PHP5.3 all additional configure options (except --enable-cgi) are removed:
-
- --enable-fastcgi CGI: If this is enabled, the cgi module will
- be built with support for fastcgi also
-
- Now fastcgi is always enabled
-
- --disable-path-info-check CGI: If this is disabled, paths such as
- /info.php/test?a=b will fail to work
-
- Now it is enabled by default, but can be disabled
- with ini directive "cgi.fix_pathinfo=0"
-
- --enable-force-cgi-redirect
- CGI: Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache
-
- Now it is enabled by default, but can be disabled
- with ini directive "cgi.force_redirect=0"
-
- --enable-discard-path CGI: If this is enabled, the PHP CGI binary
- can safely be placed outside of the
- web tree and people will not be able
- to circumvent .htaccess security
-
- This option had effect only with
- --disable-path-info-check or "cgi.fix_pathinfo=0".
- Seems it needs only for CGI configuration that
- require each script start from "#! /usr/bin/php".
-
- Now it is disabled by default, but can be enabled
- with ini directive "cgi.discard_path=1".
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 317a887cd4..0fbacdc96e 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -666,19 +666,14 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns
static void cgi_php_import_environment_variables(zval *array_ptr)
{
+ if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) != IS_ARRAY) {
+ zend_is_auto_global_str("_ENV", sizeof("_ENV")-1);
+ }
+
if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY &&
- Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) &&
- zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0
- ) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]);
- return;
- } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
- Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) &&
- zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0
- ) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]);
+ Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) {
+ zend_array_destroy(Z_ARR_P(array_ptr));
+ Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_ENV]));
return;
}
@@ -1758,7 +1753,7 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
ZEND_END_ARG_INFO()
-const zend_function_entry cgi_functions[] = {
+static const zend_function_entry cgi_functions[] = {
PHP_FE(apache_child_terminate, arginfo_no_args)
PHP_FE(apache_request_headers, arginfo_no_args)
PHP_FE(apache_response_headers, arginfo_no_args)
@@ -2025,6 +2020,11 @@ consult the installation file that came with this distribution, or visit \n\
}
fastcgi = fcgi_is_fastcgi();
}
+
+ /* make php call us to get _ENV vars */
+ php_php_import_environment_variables = php_import_environment_variables;
+ php_import_environment_variables = cgi_php_import_environment_variables;
+
if (fastcgi) {
/* How many times to run PHP scripts before dying */
if (getenv("PHP_FCGI_MAX_REQUESTS")) {
@@ -2035,10 +2035,6 @@ consult the installation file that came with this distribution, or visit \n\
}
}
- /* make php call us to get _ENV vars */
- php_php_import_environment_variables = php_import_environment_variables;
- php_import_environment_variables = cgi_php_import_environment_variables;
-
/* library is already initialized, now init our request */
request = fcgi_init_request(fcgi_fd, NULL, NULL, NULL);
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/php_cli.c b/sapi/cli/php_cli.c
index b217b2731d..f124c8a1f8 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -593,17 +593,17 @@ static void cli_register_file_handles(void) /* {{{ */
php_stream_to_zval(s_err, &ec.value);
ic.flags = CONST_CS;
- ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
+ ic.name = zend_string_init_interned("STDIN", sizeof("STDIN")-1, 0);
ic.module_number = 0;
zend_register_constant(&ic);
oc.flags = CONST_CS;
- oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
+ oc.name = zend_string_init_interned("STDOUT", sizeof("STDOUT")-1, 0);
oc.module_number = 0;
zend_register_constant(&oc);
ec.flags = CONST_CS;
- ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
+ ec.name = zend_string_init_interned("STDERR", sizeof("STDERR")-1, 0);
ec.module_number = 0;
zend_register_constant(&ec);
}
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 239f4a1cd3..72eb1c170d 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1574,10 +1574,13 @@ 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(lc_header_name);
zend_string_release(orig_header_name);
if (client->current_header_name_allocated) {
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index 849a8b14e5..72f0c5dfa5 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -6,6 +6,9 @@ include "skipif.inc";
if (!extension_loaded("reflection") || !extension_loaded("session")) {
die("skip reflection and session extensions required");
}
+if (PCRE_JIT_SUPPORT == false) {
+ die ("skip not pcre jit support builtin");
+}
?>
--INI--
date.timezone=
@@ -39,7 +42,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
}
}
- - Constants [16] {
+ - Constants [19] {
Constant [ integer PREG_PATTERN_ORDER ] { 1 }
Constant [ integer PREG_SET_ORDER ] { 2 }
Constant [ integer PREG_OFFSET_CAPTURE ] { 256 }
@@ -56,6 +59,9 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Constant [ integer PREG_BAD_UTF8_OFFSET_ERROR ] { 5 }
Constant [ integer PREG_JIT_STACKLIMIT_ERROR ] { 6 }
Constant [ string PCRE_VERSION ] { %s }
+ Constant [ integer PCRE_VERSION_MAJOR ] { %d }
+ Constant [ integer PCRE_VERSION_MINOR ] { %d }
+ Constant [ boolean PCRE_JIT_SUPPORT ] { %d }
}
- Functions {
diff --git a/sapi/cli/tests/012-2.phpt b/sapi/cli/tests/012-2.phpt
new file mode 100644
index 0000000000..34be936708
--- /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";
+?>
+--EXPECTF--
+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/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_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/fpm/.gitignore b/sapi/fpm/.gitignore
deleted file mode 100644
index 3f8c0913a4..0000000000
--- a/sapi/fpm/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-php-fpm.8
-php-fpm.service
-status.html
-www.conf
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index f0cc3a07a4..cd391606e1 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -568,15 +568,15 @@ void cgi_php_import_environment_variables(zval *array_ptr) /* {{{ */
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0
) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]);
+ zend_array_destroy(Z_ARR_P(array_ptr));
+ Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_ENV]));
return;
} else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0
) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]);
+ zend_array_destroy(Z_ARR_P(array_ptr));
+ Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]));
return;
}
@@ -1595,6 +1595,10 @@ int main(int argc, char *argv[])
int force_stderr = 0;
int php_information = 0;
int php_allow_to_run_as_root = 0;
+ int ret;
+#if ZEND_RC_DEBUG
+ zend_bool old_rc_debug;
+#endif
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
@@ -1858,7 +1862,18 @@ consult the installation file that came with this distribution, or visit \n\
}
}
- if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon, force_stderr)) {
+#if ZEND_RC_DEBUG
+ old_rc_debug = zend_rc_debug;
+ zend_rc_debug = 0;
+#endif
+
+ ret = fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon, force_stderr);
+
+#if ZEND_RC_DEBUG
+ zend_rc_debug = old_rc_debug;
+#endif
+
+ if (ret < 0) {
if (fpm_globals.send_config_pipe[1]) {
int writeval = 0;
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index d58a8f82b6..f16bdfb938 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -179,7 +179,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
if (wp->listen_address_domain == FPM_AF_UNIX) {
if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) {
- zlog(ZLOG_ERROR, "An another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path);
+ zlog(ZLOG_ERROR, "Another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path);
close(sock);
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index 42d7d7bae0..92b55ab457 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -151,9 +151,9 @@ int fpm_status_handle_request(void) /* {{{ */
"<tr><th>start since</th><td>%lu</td></tr>\n"
"<tr><th>accepted conn</th><td>%lu</td></tr>\n"
#ifdef HAVE_FPM_LQ
- "<tr><th>listen queue</th><td>%u</td></tr>\n"
- "<tr><th>max listen queue</th><td>%u</td></tr>\n"
- "<tr><th>listen queue len</th><td>%d</td></tr>\n"
+ "<tr><th>listen queue</th><td>%d</td></tr>\n"
+ "<tr><th>max listen queue</th><td>%d</td></tr>\n"
+ "<tr><th>listen queue len</th><td>%u</td></tr>\n"
#endif
"<tr><th>idle processes</th><td>%d</td></tr>\n"
"<tr><th>active processes</th><td>%d</td></tr>\n"
@@ -223,9 +223,9 @@ int fpm_status_handle_request(void) /* {{{ */
"<start-since>%lu</start-since>\n"
"<accepted-conn>%lu</accepted-conn>\n"
#ifdef HAVE_FPM_LQ
- "<listen-queue>%u</listen-queue>\n"
- "<max-listen-queue>%u</max-listen-queue>\n"
- "<listen-queue-len>%d</listen-queue-len>\n"
+ "<listen-queue>%d</listen-queue>\n"
+ "<max-listen-queue>%d</max-listen-queue>\n"
+ "<listen-queue-len>%u</listen-queue-len>\n"
#endif
"<idle-processes>%d</idle-processes>\n"
"<active-processes>%d</active-processes>\n"
@@ -273,9 +273,9 @@ int fpm_status_handle_request(void) /* {{{ */
"\"start since\":%lu,"
"\"accepted conn\":%lu,"
#ifdef HAVE_FPM_LQ
- "\"listen queue\":%u,"
- "\"max listen queue\":%u,"
- "\"listen queue len\":%d,"
+ "\"listen queue\":%d,"
+ "\"max listen queue\":%d,"
+ "\"listen queue len\":%u,"
#endif
"\"idle processes\":%d,"
"\"active processes\":%d,"
@@ -323,9 +323,9 @@ int fpm_status_handle_request(void) /* {{{ */
"start since: %lu\n"
"accepted conn: %lu\n"
#ifdef HAVE_FPM_LQ
- "listen queue: %u\n"
- "max listen queue: %u\n"
- "listen queue len: %d\n"
+ "listen queue: %d\n"
+ "max listen queue: %d\n"
+ "listen queue len: %u\n"
#endif
"idle processes: %d\n"
"active processes: %d\n"
@@ -362,7 +362,7 @@ int fpm_status_handle_request(void) /* {{{ */
scoreboard.pool,
PM2STR(scoreboard.pm),
time_buffer,
- now_epoch - scoreboard.start_epoch,
+ (unsigned long) (now_epoch - scoreboard.start_epoch),
scoreboard.requests,
#ifdef HAVE_FPM_LQ
scoreboard.lq,
@@ -443,10 +443,10 @@ int fpm_status_handle_request(void) /* {{{ */
}
strftime(time_buffer, sizeof(time_buffer) - 1, time_format, localtime(&proc.start_epoch));
spprintf(&buffer, 0, full_syntax,
- proc.pid,
+ (int) proc.pid,
fpm_request_get_stage_name(proc.request_stage),
time_buffer,
- now_epoch - proc.start_epoch,
+ (unsigned long) (now_epoch - proc.start_epoch),
proc.requests,
duration.tv_sec * 1000000UL + duration.tv_usec,
proc.request_method[0] != '\0' ? proc.request_method : "-",
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index 0126147d7d..81bd695eaf 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -244,15 +244,15 @@ static void litespeed_php_import_environment_variables(zval *array_ptr)
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0
) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]);
+ zend_array_destroy(Z_ARR_P(array_ptr));
+ Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_ENV]));
return;
} else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0
) {
- zval_dtor(array_ptr);
- ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]);
+ zend_array_destroy(Z_ARR_P(array_ptr));
+ Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]));
return;
}
@@ -1358,7 +1358,7 @@ PHP_FUNCTION(apache_get_modules);
PHP_MINFO_FUNCTION(litespeed);
-zend_function_entry litespeed_functions[] = {
+static const zend_function_entry litespeed_functions[] = {
PHP_FE(litespeed_request_headers, arginfo_litespeed__void)
PHP_FE(litespeed_response_headers, arginfo_litespeed__void)
PHP_FE(apache_get_modules, arginfo_litespeed__void)
diff --git a/sapi/phpdbg/.gitignore b/sapi/phpdbg/.gitignore
deleted file mode 100644
index 51165dab2f..0000000000
--- a/sapi/phpdbg/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.libs/
-phpdbg
-*.lo
-*.o
-*.output
-build
diff --git a/sapi/phpdbg/.travis.yml b/sapi/phpdbg/.travis.yml
deleted file mode 100644
index 2e777fbe13..0000000000
--- a/sapi/phpdbg/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: c
-
-env:
-- PHP="PHP-5.4"
-- PHP="PHP-5.5"
-- PHP="PHP-5.6"
-
-before_script: ./travis/ci.sh
-
-script:
-- ./php-src/sapi/cli/php php-src/sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg php-src/sapi/phpdbg/phpdbg
diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md
index a2a84deb7b..9d1163bc47 100644
--- a/sapi/phpdbg/README.md
+++ b/sapi/phpdbg/README.md
@@ -5,8 +5,6 @@ Implemented as a SAPI module, phpdbg can exert complete control over the environ
phpdbg aims to be a lightweight, powerful, easy to use debugging platform for PHP 5.4+
-[![phpdbg on travis-ci](https://travis-ci.org/krakjoe/phpdbg.png?branch=master)](https://travis-ci.org/krakjoe/phpdbg)
-
Features
========
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index 9fb4e62984..c3a26d38d5 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -46,6 +46,7 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
\$(EXTRA_LIBS) \
\$(PHPDBG_EXTRA_LIBS) \
\$(ZEND_EXTRA_LIBS) \
+ \$(PHP_FRAMEWORKS) \
-o \$(BUILD_BINARY)"
BUILD_PHPDBG_SHARED="\$(LIBTOOL) --mode=link \
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index c444a72d5f..706367ed35 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -580,10 +580,10 @@ static PHP_FUNCTION(phpdbg_get_executable)
zend_hash_add_empty_element(files, zval_get_string(filename));
} ZEND_HASH_FOREACH_END();
} else {
- GC_REFCOUNT(files)++;
+ GC_ADDREF(files);
}
} else {
- GC_REFCOUNT(files)++;
+ GC_ADDREF(files);
}
array_init(return_value);
@@ -632,7 +632,7 @@ static PHP_FUNCTION(phpdbg_get_executable)
}
} ZEND_HASH_FOREACH_END();
- if (!--GC_REFCOUNT(files)) {
+ if (!GC_DELREF(files)) {
zend_hash_destroy(files);
}
}
@@ -783,7 +783,7 @@ ZEND_BEGIN_ARG_INFO_EX(phpdbg_get_executable_arginfo, 0, 0, 0)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
-zend_function_entry phpdbg_user_functions[] = {
+static const zend_function_entry phpdbg_user_functions[] = {
PHP_FE(phpdbg_clear, phpdbg_clear_arginfo)
PHP_FE(phpdbg_break_next, phpdbg_break_next_arginfo)
PHP_FE(phpdbg_break_file, phpdbg_break_file_arginfo)
@@ -1356,7 +1356,7 @@ php_stream *phpdbg_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *
return stream;
}
- return PHPDBG_G(orig_url_wrap_php)(wrapper, path, mode, options, opened_path, context STREAMS_CC);
+ return PHPDBG_G(orig_url_wrap_php)->wops->stream_opener(wrapper, path, mode, options, opened_path, context STREAMS_CC);
} /* }}} */
int main(int argc, char **argv) /* {{{ */
@@ -1399,6 +1399,8 @@ int main(int argc, char **argv) /* {{{ */
void* (*_malloc)(size_t);
void (*_free)(void*);
void* (*_realloc)(void*, size_t);
+ php_stream_wrapper wrapper;
+ php_stream_wrapper_ops wops;
#ifndef _WIN32
@@ -1867,9 +1869,14 @@ phpdbg_main:
}
{
- php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
- PHPDBG_G(orig_url_wrap_php) = wrapper->wops->stream_opener;
- wrapper->wops->stream_opener = phpdbg_stream_url_wrap_php;
+ zval *zv = zend_hash_str_find(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
+ php_stream_wrapper *tmp_wrapper = Z_PTR_P(zv);
+ PHPDBG_G(orig_url_wrap_php) = tmp_wrapper;
+ memcpy(&wrapper, tmp_wrapper, sizeof(wrapper));
+ memcpy(&wops, tmp_wrapper->wops, sizeof(wops));
+ wops.stream_opener = phpdbg_stream_url_wrap_php;
+ wrapper.wops = (const php_stream_wrapper_ops*)&wops;
+ Z_PTR_P(zv) = &wrapper;
}
/* Make stdin, stdout and stderr accessible from PHP scripts */
@@ -2096,6 +2103,7 @@ phpdbg_out:
if (PHPDBG_G(exec) && strcmp("Standard input code", PHPDBG_G(exec)) == SUCCESS) { /* i.e. execution context has been read from stdin - back it up */
phpdbg_file_source *data = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), PHPDBG_G(exec), PHPDBG_G(exec_len));
backup_phpdbg_compile = zend_string_alloc(data->len + 2, 1);
+ GC_MAKE_PERSISTENT_LOCAL(backup_phpdbg_compile);
sprintf(ZSTR_VAL(backup_phpdbg_compile), "?>%.*s", (int) data->len, data->buf);
}
@@ -2147,8 +2155,8 @@ phpdbg_out:
}
{
- php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
- wrapper->wops->stream_opener = PHPDBG_G(orig_url_wrap_php);
+ zval *zv = zend_hash_str_find(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
+ Z_PTR_P(zv) = (void*)PHPDBG_G(orig_url_wrap_php);
}
zend_hash_destroy(&PHPDBG_G(file_sources));
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index 980db28be9..7560eec7e0 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -308,7 +308,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
zend_bool last_was_newline; /* check if we don't need to output a newline upon next phpdbg_error or phpdbg_notice */
FILE *stdin_file; /* FILE pointer to stdin source file */
- php_stream *(*orig_url_wrap_php)(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
+ const php_stream_wrapper *orig_url_wrap_php;
char input_buffer[PHPDBG_MAX_CMD]; /* stdin input buffer */
int input_buflen; /* length of stdin input buffer */
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index b4a878818b..0054e90cea 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -751,7 +751,11 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
}
if (buffered == NULL) {
-#define USE_LIB_STAR (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT))
+#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
+#define USE_LIB_STAR 1
+#else
+#define USE_LIB_STAR 0
+#endif
/* note: EOF makes readline write prompt again in local console mode - and ignored if compiled without readline */
#if USE_LIB_STAR
if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd))
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 0fd3d17edf..313bb4fae8 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -37,7 +37,7 @@ static inline const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
} /* }}} */
static inline char *phpdbg_decode_op(
- zend_op_array *ops, const znode_op *op, uint32_t type) /* {{{ */
+ zend_op_array *ops, const zend_op *opline, const znode_op *op, uint32_t type) /* {{{ */
{
char *decode = NULL;
@@ -56,7 +56,7 @@ static inline char *phpdbg_decode_op(
spprintf(&decode, 0, "~%u", EX_VAR_TO_NUM(op->var) - ops->last_var);
break;
case IS_CONST: {
- zval *literal = RT_CONSTANT(ops, *op);
+ zval *literal = RT_CONSTANT(opline, *op);
decode = phpdbg_short_zval_print(literal, 20);
} break;
}
@@ -68,7 +68,7 @@ char *phpdbg_decode_input_op(
uint32_t flags) {
char *result = NULL;
if (op_type != IS_UNUSED) {
- result = phpdbg_decode_op(ops, &op, op_type);
+ result = phpdbg_decode_op(ops, opline, &op, op_type);
} else if (ZEND_VM_OP_JMP_ADDR == (flags & ZEND_VM_OP_MASK)) {
spprintf(&result, 0, "J%td", OP_JMP_ADDR(opline, op) - ops->opcodes);
} else if (ZEND_VM_OP_NUM == (flags & ZEND_VM_OP_MASK)) {
@@ -118,7 +118,7 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *opline) /*{{{ */
spprintf(&decode[3], 0, "%" PRIu32, opline->result.num);
break;
default:
- decode[3] = phpdbg_decode_op(ops, &opline->result, opline->result_type);
+ decode[3] = phpdbg_decode_op(ops, opline, &opline->result, opline->result_type);
break;
}
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 4d264ba53c..da5cb0c4f8 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.h
@@ -34,11 +34,18 @@ enum {
P_LOG
};
-PHPDBG_API int phpdbg_print(int severity, int fd, const char *tag, const char *xmlfmt, const char *strfmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 5, 6);
-PHPDBG_API int phpdbg_xml_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
-PHPDBG_API int phpdbg_log_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
-PHPDBG_API int phpdbg_out_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
-PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
+/* phpdbg uses lots of custom format specifiers, so we disable format checks by default. */
+#if defined(PHPDBG_CHECK_FORMAT_STRINGS)
+# define PHPDBG_ATTRIBUTE_FORMAT(type, idx, first) PHP_ATTRIBUTE_FORMAT(type, idx, first)
+#else
+# define PHPDBG_ATTRIBUTE_FORMAT(type, idx, first)
+#endif
+
+PHPDBG_API int phpdbg_print(int severity, int fd, const char *tag, const char *xmlfmt, const char *strfmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 5, 6);
+PHPDBG_API int phpdbg_xml_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3);
+PHPDBG_API int phpdbg_log_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3);
+PHPDBG_API int phpdbg_out_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3);
+PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3);
#define phpdbg_error(tag, xmlfmt, strfmt, ...) phpdbg_print(P_ERROR , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag, xmlfmt, strfmt, ##__VA_ARGS__)
#define phpdbg_notice(tag, xmlfmt, strfmt, ...) phpdbg_print(P_NOTICE , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag, xmlfmt, strfmt, ##__VA_ARGS__)
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index fc25e30af1..c845ee194f 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1692,7 +1692,7 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */
backup_opline = EG(current_execute_data)->opline; \
} \
before_ex = EG(opline_before_exception); \
- ++GC_REFCOUNT(exception); \
+ GC_ADDREF(exception); \
zend_clear_exception(); \
} \
if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { \
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.c b/sapi/phpdbg/phpdbg_rinit_hook.c
index 685c5b75a9..d923f7c1d2 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.c
+++ b/sapi/phpdbg/phpdbg_rinit_hook.c
@@ -56,9 +56,9 @@ static PHP_RINIT_FUNCTION(phpdbg_webhelper) /* {{{ */
{
struct sockaddr_un sock;
int s = socket(AF_UNIX, SOCK_STREAM, 0);
- int len = strlen(PHPDBG_WG(path)) + sizeof(sock.sun_family);
+ size_t len = strlen(PHPDBG_WG(path)) + sizeof(sock.sun_family);
char buf[(1 << 8) + 1];
- int buflen;
+ ssize_t buflen;
sock.sun_family = AF_UNIX;
strcpy(sock.sun_path, PHPDBG_WG(path));
@@ -67,11 +67,15 @@ static PHP_RINIT_FUNCTION(phpdbg_webhelper) /* {{{ */
}
char *msg = NULL;
- char msglen[5] = {0};
- phpdbg_webdata_compress(&msg, (int *)msglen);
-
- send(s, msglen, 4, 0);
- send(s, msg, *(int *) msglen, 0);
+ size_t msglen = 0;
+ phpdbg_webdata_compress(&msg, &msglen);
+
+ buf[0] = (msglen >> 0) & 0xff;
+ buf[1] = (msglen >> 8) & 0xff;
+ buf[2] = (msglen >> 16) & 0xff;
+ buf[3] = (msglen >> 24) & 0xff;
+ send(s, buf, 4, 0);
+ send(s, msg, msglen, 0);
while ((buflen = recv(s, buf, sizeof(buf) - 1, 0)) > 0) {
php_write(buf, buflen);
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 380e9f9e16..005015d850 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -687,10 +687,12 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(zv);
- if (ZEND_HASH_APPLY_PROTECTION(myht) && ++myht->u.v.nApplyCount > 1) {
- phpdbg_xml("<recursion />");
- --myht->u.v.nApplyCount;
- break;
+ if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
+ if (GC_IS_RECURSIVE(myht)) {
+ phpdbg_xml("<recursion />");
+ break;
+ }
+ GC_PROTECT_RECURSION(myht);
}
phpdbg_xml("<array refstatus=\"%s\" num=\"%d\">", COMMON, zend_hash_num_elements(myht));
element_dump_func = phpdbg_xml_array_element_dump;
@@ -698,9 +700,8 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
goto head_done;
case IS_OBJECT:
myht = Z_OBJDEBUG_P(zv, is_temp);
- if (myht && ++myht->u.v.nApplyCount > 1) {
+ if (myht && GC_IS_RECURSIVE(myht)) {
phpdbg_xml("<recursion />");
- --myht->u.v.nApplyCount;
break;
}
@@ -715,7 +716,7 @@ head_done:
element_dump_func(val, key, num);
} ZEND_HASH_FOREACH_END();
zend_hash_apply_with_arguments(myht, (apply_func_args_t) element_dump_func, 0);
- --myht->u.v.nApplyCount;
+ GC_UNPROTECT_RECURSION(myht);
if (is_temp) {
zend_hash_destroy(myht);
efree(myht);
@@ -763,9 +764,9 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
zend_class_entry *ce;
cur = &op_array->opcodes[catch];
- if (!(ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(cur->op1))))) {
- ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(cur->op1)), EX_CONSTANT(cur->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
- CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(cur->op1)), ce);
+ if (!(ce = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(cur, cur->op1))))) {
+ ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(cur, cur->op1)), RT_CONSTANT(cur, cur->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
+ CACHE_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(cur, cur->op1)), ce);
}
if (ce == exception->ce || (ce && instanceof_function(exception->ce, ce))) {
@@ -843,12 +844,17 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+');
break;
}
- case IS_CONSTANT:
- decode = estrdup("<constant>");
- break;
- case IS_CONSTANT_AST:
- decode = estrdup("<ast>");
+ case IS_CONSTANT_AST: {
+ zend_ast *ast = Z_ASTVAL_P(zv);
+
+ if (ast->kind == ZEND_AST_CONSTANT
+ || ast->kind == ZEND_AST_CONSTANT_CLASS) {
+ decode = estrdup("<constant>");
+ } else {
+ decode = estrdup("<ast>");
+ }
break;
+ }
default:
spprintf(&decode, 0, "unknown type: %d", Z_TYPE_P(zv));
break;
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index 0c0df7f97a..88593c552f 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.c
@@ -326,6 +326,7 @@ void phpdbg_watch_backup_data(phpdbg_watchpoint_t *watch) {
zend_string_release(watch->backup.str);
}
watch->backup.str = zend_string_init((char *) watch->addr.ptr + XtOffsetOf(zend_string, val) - XtOffsetOf(zend_string, len), *(size_t *) watch->addr.ptr, 1);
+ GC_MAKE_PERSISTENT_LOCAL(watch->backup.str);
break;
case WATCH_ON_HASHTABLE:
memcpy((char *) &watch->backup + HT_WATCH_OFFSET, watch->addr.ptr, watch->size);
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c
index ed0a853709..16c82a6118 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.c
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.c
@@ -27,7 +27,7 @@ static int phpdbg_is_auto_global(char *name, int len) {
return ret;
}
-PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len) {
+PHPDBG_API void phpdbg_webdata_compress(char **msg, size_t *len) {
zval array;
HashTable *ht;
zval zv[9] = {{{0}}};
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.h b/sapi/phpdbg/phpdbg_webdata_transfer.h
index 3a55fbe10f..aa736a78b9 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.h
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.h
@@ -22,6 +22,6 @@
#include "zend.h"
#include "phpdbg.h"
-PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len);
+PHPDBG_API void phpdbg_webdata_compress(char **msg, size_t *len);
#endif /* PHPDBG_WEBDATA_TRANSFER_H */
diff --git a/sapi/phpdbg/tests/run_001.phpt b/sapi/phpdbg/tests/run_001.phpt
index 30aab1f17a..626ecb323b 100644
--- a/sapi/phpdbg/tests/run_001.phpt
+++ b/sapi/phpdbg/tests/run_001.phpt
@@ -21,7 +21,7 @@ array(5) {
string(1) "3"
}
[Script ended normally]
-prompt> int(5)
+prompt> int(4)
array(4) {
[0]=>
string(%d) "%s"
diff --git a/sapi/phpdbg/travis/ci.sh b/sapi/phpdbg/travis/ci.sh
deleted file mode 100755
index 206b158b9b..0000000000
--- a/sapi/phpdbg/travis/ci.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env sh
-git clone https://github.com/php/php-src
-cd php-src
-git checkout $PHP
-cd sapi
-rm -rf phpdbg
-git clone https://github.com/krakjoe/phpdbg.git
-cd ../
-./buildconf --force
-./configure --disable-all --enable-phpdbg --enable-maintainer-zts
-make