summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-11-26 08:17:35 +0100
committerAnatol Belski <ab@php.net>2014-11-26 08:17:35 +0100
commit3ca0ca1548324e8993e0707dfaf67a8cb58a0fb2 (patch)
treeed14da274390f69bc4235a1f21121cfe8b370144 /sapi
parent4f3ac2cdbedf7a84d64bfee7405f0c023641a806 (diff)
parent108b2c4bb993f7bd3855a801f71175fd65c6828a (diff)
downloadphp-git-3ca0ca1548324e8993e0707dfaf67a8cb58a0fb2.tar.gz
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (102 commits) fix dir separator in test fix TS build fix TS build Better fix for bug #68446 Revert "Merge remote-tracking branch 'origin/PHP-5.6'" Revert NEWS and set test to XFAIL Revert "Fix bug #68446 (bug with constant defaults and type hints)" Improved zend_hash_clean() and added new optimized zend_symtable_clean() Use inline version of zval_ptr_dtor() Added new optimized zend_array_destroy() function Moved i_zval_ptr_dtor() from zend_execute.h to zend_variables.h fix REGISTER_NS_*_CONSTANT macros Removed useless assert. EG(uninitialized_zval) can't be refcounted. Use specialized destructors when types of zvals are known. move tests into proper place Improved assignment to object property Reuse zend_assign_to_variable() in zend_std_write_property() cleanup comments from svn/cvs era fix dir separator in test fork test for windows ...
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c2
-rw-r--r--sapi/cli/php_http_parser.c2
-rw-r--r--sapi/fpm/fpm/fpm_conf.c8
-rw-r--r--sapi/fpm/fpm/fpm_env.c2
-rw-r--r--sapi/fpm/fpm/fpm_log.c2
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c18
-rw-r--r--sapi/fpm/php-fpm.conf.in5
-rw-r--r--sapi/fpm/tests/016.phpt87
-rw-r--r--sapi/fpm/tests/017.phpt67
-rw-r--r--sapi/fpm/tests/019.phpt80
-rw-r--r--sapi/fpm/tests/020.phpt76
-rw-r--r--sapi/litespeed/lsapi_main.c116
-rw-r--r--sapi/litespeed/lsapilib.c2
-rw-r--r--sapi/nsapi/nsapi-readme.txt2
-rw-r--r--sapi/phpdbg/phpdbg.c2
-rw-r--r--sapi/phpdbg/xml.md6
-rw-r--r--sapi/thttpd/thttpd_patch2
17 files changed, 423 insertions, 56 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 10c7fbf355..5807d8a64d 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -2287,7 +2287,7 @@ consult the installation file that came with this distribution, or visit \n\
/* all remaining arguments are part of the query string
* this section of code concatenates all remaining arguments
- * into a single string, seperating args with a &
+ * into a single string, separating args with a &
* this allows command lines like:
*
* test.php v1=test v2=hello+world!
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index cc649af79a..31ae4167d1 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -1378,7 +1378,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
/* Here we call the headers_complete callback. This is somewhat
* different than other callbacks because if the user returns 1, we
* will interpret that as saying that this message has no body. This
- * is needed for the annoying case of recieving a response to a HEAD
+ * is needed for the annoying case of receiving a response to a HEAD
* request.
*/
if (settings->on_headers_complete) {
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 1ee0169698..d4e46853ff 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -1200,15 +1200,15 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */
return -1;
}
- if (0 > fpm_log_open(0)) {
+ if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) {
return -1;
}
- if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) {
+ if (0 > fpm_conf_process_all_pools()) {
return -1;
}
- if (0 > fpm_conf_process_all_pools()) {
+ if (0 > fpm_log_open(0)) {
return -1;
}
@@ -1257,7 +1257,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ *
#ifdef HAVE_GLOB
{
g.gl_offs = 0;
- if ((i = glob(inc, GLOB_ERR | GLOB_MARK | GLOB_NOSORT, NULL, &g)) != 0) {
+ if ((i = glob(inc, GLOB_ERR | GLOB_MARK, NULL, &g)) != 0) {
#ifdef GLOB_NOMATCH
if (i == GLOB_NOMATCH) {
zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno);
diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c
index 2ff0bdc0e4..3bdb346341 100644
--- a/sapi/fpm/fpm/fpm_env.c
+++ b/sapi/fpm/fpm/fpm_env.c
@@ -212,7 +212,7 @@ int fpm_env_init_main() /* {{{ */
#ifndef HAVE_SETPROCTITLE
#ifdef __linux__
/*
- * This piece of code has been inspirated from nginx and pureftpd code, whic
+ * This piece of code has been inspirated from nginx and pureftpd code, which
* are under BSD licence.
*
* To change the process title in Linux we have to set argv[1] to NULL
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index c71281b0b9..b0bf32ac16 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -46,6 +46,8 @@ int fpm_log_open(int reopen) /* {{{ */
if (0 > fd) {
zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log);
return -1;
+ } else {
+ zlog(ZLOG_DEBUG, "open access log (%s)", wp->config->access_log);
}
if (reopen) {
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index 0286f0eee8..e4e494876f 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -268,6 +268,8 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
} else if (strlen(dup_address) == strspn(dup_address, "0123456789")) { /* this is port */
port = atoi(dup_address);
port_str = dup_address;
+ /* IPv6 catch-all + IPv4-mapped */
+ addr = "::";
}
if (port == 0) {
@@ -275,18 +277,6 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
return -1;
}
- if (!addr) {
- /* no address: default documented behavior, all IPv4 addresses */
- struct sockaddr_in sa_in;
-
- memset(&sa_in, 0, sizeof(sa_in));
- sa_in.sin_family = AF_INET;
- sa_in.sin_port = htons(port);
- sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
- free(dup_address);
- return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
- }
-
/* strip brackets from address for getaddrinfo */
addr_len = strlen(addr);
if (addr[0] == '[' && addr[addr_len - 1] == ']') {
@@ -307,10 +297,10 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
inet_ntop(p->ai_family, fpm_get_in_addr(p->ai_addr), tmpbuf, INET6_ADDRSTRLEN);
if (sock < 0) {
if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
- zlog(ZLOG_DEBUG, "Found address for %s, socket opened on %s", dup_address, tmpbuf);
+ zlog(ZLOG_DEBUG, "Found address for %s, socket opened on %s", addr, tmpbuf);
}
} else {
- zlog(ZLOG_WARNING, "Found multiple addresses for %s, %s ignored", dup_address, tmpbuf);
+ zlog(ZLOG_WARNING, "Found multiple addresses for %s, %s ignored", addr, tmpbuf);
}
}
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index bcdfe56a10..850a369002 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -131,6 +131,7 @@
; Per pool prefix
; It only applies on the following directives:
+; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
@@ -154,9 +155,7 @@ group = @php_fpm_group@
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
-; 'port' - to listen on a TCP socket to all IPv4 addresses on a
-; specific port;
-; '[::]:port' - to listen on a TCP socket to all addresses
+; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
diff --git a/sapi/fpm/tests/016.phpt b/sapi/fpm/tests/016.phpt
new file mode 100644
index 0000000000..1a9e8e7577
--- /dev/null
+++ b/sapi/fpm/tests/016.phpt
@@ -0,0 +1,87 @@
+--TEST--
+FPM: Test splited configuration and load order #68391
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = __DIR__.'/php-fpm.log.tmp';
+$logdir = __DIR__.'/conf.d';
+$port = 9000+PHP_INT_SIZE;
+
+// Main configuration
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+log_level = notice
+include = $logdir/*.conf
+EOT;
+
+// Splited configuration
+@mkdir($logdir);
+$i=$port;
+$names = ['cccc', 'aaaa', 'eeee', 'dddd', 'bbbb'];
+foreach($names as $name) {
+ $poolcfg = <<<EOT
+[$name]
+listen = 127.0.0.1:$i
+listen.allowed_clients=127.0.0.1
+user = foo
+pm = ondemand
+pm.max_children = 5
+EOT;
+ file_put_contents("$logdir/$name.conf", $poolcfg);
+ $i++;
+}
+
+// Test
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, count($names)+2);
+ $i=$port;
+ foreach($names as $name) {
+ try {
+ run_request('127.0.0.1', $i++);
+ echo "OK $name\n";
+ } catch (Exception $e) {
+ echo "Error 1\n";
+ }
+ }
+ proc_terminate($fpm);
+ if (!feof($tail)) {
+ echo stream_get_contents($tail);
+ }
+ fclose($tail);
+ proc_close($fpm);
+}
+
+?>
+Done
+--EXPECTF--
+[%s] NOTICE: [pool aaaa] 'user' directive is ignored when FPM is not running as root
+[%s] NOTICE: [pool bbbb] 'user' directive is ignored when FPM is not running as root
+[%s] NOTICE: [pool cccc] 'user' directive is ignored when FPM is not running as root
+[%s] NOTICE: [pool dddd] 'user' directive is ignored when FPM is not running as root
+[%s] NOTICE: [pool eeee] 'user' directive is ignored when FPM is not running as root
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+OK cccc
+OK aaaa
+OK eeee
+OK dddd
+OK bbbb
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+Done
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $logdir = __DIR__.'/conf.d';
+ @unlink($logfile);
+ foreach(glob("$logdir/*.conf") as $name) {
+ unlink($name);
+ }
+ @rmdir($logdir);
+?> \ No newline at end of file
diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt
new file mode 100644
index 0000000000..b3de089a70
--- /dev/null
+++ b/sapi/fpm/tests/017.phpt
@@ -0,0 +1,67 @@
+--TEST--
+FPM: Test fastcgi_finish_request function
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = __DIR__.'/php-fpm.log.tmp';
+$srcfile = __DIR__.'/php-fpm.tmp.php';
+$port = 9000+PHP_INT_SIZE;
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+[unconfined]
+listen = 127.0.0.1:$port
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 1
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+EOT;
+
+$code = <<<EOT
+<?php
+echo "Test Start\n";
+fastcgi_finish_request();
+echo "Test End\n";
+EOT;
+file_put_contents($srcfile, $code);
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ $req = run_request('127.0.0.1', $port, $srcfile);
+ echo strstr($req, "Test Start");
+ echo "Request ok\n";
+ } catch (Exception $e) {
+ echo "Request error\n";
+ }
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+}
+
+?>
+Done
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Test Start
+
+Request ok
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+Done
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $srcfile = __DIR__.'/php-fpm.tmp.php';
+ @unlink($logfile);
+ @unlink($srcfile);
+?> \ No newline at end of file
diff --git a/sapi/fpm/tests/019.phpt b/sapi/fpm/tests/019.phpt
new file mode 100644
index 0000000000..cdf8126244
--- /dev/null
+++ b/sapi/fpm/tests/019.phpt
@@ -0,0 +1,80 @@
+--TEST--
+FPM: Test global prefix
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = 'php-fpm.log.tmp';
+$accfile = 'php-fpm.acc.tmp';
+$slwfile = 'php-fpm.slw.tmp';
+$pidfile = 'php-fpm.pid.tmp';
+$port = 9000+PHP_INT_SIZE;
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+pid = $pidfile
+[test]
+listen = 127.0.0.1:$port
+access.log = $accfile
+slowlog = $slwfile;
+request_slowlog_timeout = 1
+ping.path = /ping
+ping.response = pong
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+catch_workers_output = yes
+EOT;
+
+$fpm = run_fpm($cfg, $tail, '--prefix '.__DIR__);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ run_request('127.0.0.1', $port);
+ echo "Ping ok\n";
+ } catch (Exception $e) {
+ echo "Ping error\n";
+ }
+ printf("File %s %s\n", $logfile, (file_exists(__DIR__.'/'.$logfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $accfile, (file_exists(__DIR__.'/'.$accfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $slwfile, (file_exists(__DIR__.'/'.$slwfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ? "exists" : "missing"));
+
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+ printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ? "still exists" : "removed"));
+ readfile(__DIR__.'/'.$accfile);
+}
+
+?>
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Ping ok
+File php-fpm.log.tmp exists
+File php-fpm.acc.tmp exists
+File php-fpm.slw.tmp exists
+File php-fpm.pid.tmp exists
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+File php-fpm.pid.tmp removed
+127.0.0.1 - %s "GET /ping" 200
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $accfile = __DIR__.'/php-fpm.acc.tmp';
+ $slwfile = __DIR__.'/php-fpm.slw.tmp';
+ $pidfile = __DIR__.'/php-fpm.pid.tmp';
+ @unlink($logfile);
+ @unlink($accfile);
+ @unlink($slwfile);
+ @unlink($pidfile);
+?>
diff --git a/sapi/fpm/tests/020.phpt b/sapi/fpm/tests/020.phpt
new file mode 100644
index 0000000000..d45eeccff8
--- /dev/null
+++ b/sapi/fpm/tests/020.phpt
@@ -0,0 +1,76 @@
+--TEST--
+FPM: Test pool prefix
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$prefix = __DIR__;
+$logfile = __DIR__.'/php-fpm.log.tmp';
+$accfile = 'php-fpm.acc.tmp';
+$slwfile = 'php-fpm.slw.tmp';
+$pidfile = __DIR__.'/php-fpm.pid.tmp';
+$port = 9000+PHP_INT_SIZE;
+$cfg = <<<EOT
+
+[global]
+error_log = $logfile
+pid = $pidfile
+[test]
+prefix = $prefix;
+listen = 127.0.0.1:$port
+access.log = $accfile
+slowlog = $slwfile;
+request_slowlog_timeout = 1
+ping.path = /ping
+ping.response = pong
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+catch_workers_output = yes
+EOT;
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ run_request('127.0.0.1', $port);
+ echo "Ping ok\n";
+ } catch (Exception $e) {
+ echo "Ping error\n";
+ }
+ printf("File %s %s\n", $accfile, (file_exists(__DIR__.'/'.$accfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $slwfile, (file_exists(__DIR__.'/'.$slwfile) ? "exists" : "missing"));
+
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+ readfile(__DIR__.'/'.$accfile);
+}
+
+?>
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Ping ok
+File php-fpm.acc.tmp exists
+File php-fpm.slw.tmp exists
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+127.0.0.1 - %s "GET /ping" 200
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $accfile = __DIR__.'/php-fpm.acc.tmp';
+ $slwfile = __DIR__.'/php-fpm.slw.tmp';
+ $pidfile = __DIR__.'/php-fpm.pid.tmp';
+ @unlink($logfile);
+ @unlink($accfile);
+ @unlink($slwfile);
+ @unlink($pidfile);
+?>
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index a9f27fcea1..54b7ef9166 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -200,7 +200,12 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC )
static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen,
void * arg )
{
- int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
+#if PHP_MAJOR_VERSION >= 7
+ int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))
+ ? PARSE_ENV : PARSE_SERVER;
+#else
+ int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
+#endif
char * new_val = (char *) pValue;
unsigned int new_val_len;
@@ -238,27 +243,45 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC
size_t alloc_size = sizeof(buf);
unsigned long nlen; /* ptrdiff_t is not portable */
- if (PG(http_globals)[TRACK_VARS_ENV] &&
- array_ptr != PG(http_globals)[TRACK_VARS_ENV] &&
- Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY &&
- zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0
+#if PHP_MAJOR_VERSION >= 7
+ 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);
- *array_ptr = *PG(http_globals)[TRACK_VARS_ENV];
- INIT_PZVAL(array_ptr);
- zval_copy_ctor(array_ptr);
+ zval_dtor(array_ptr);
+ ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]);
return;
- } else if (PG(http_globals)[TRACK_VARS_SERVER] &&
- array_ptr != PG(http_globals)[TRACK_VARS_SERVER] &&
- Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
- zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0
+ } 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);
- *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER];
- INIT_PZVAL(array_ptr);
- zval_copy_ctor(array_ptr);
+ zval_dtor(array_ptr);
+ ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]);
return;
}
+#else
+ if (PG(http_globals)[TRACK_VARS_ENV] &&
+ array_ptr != PG(http_globals)[TRACK_VARS_ENV] &&
+ Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY &&
+ zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0
+ ) {
+ zval_dtor(array_ptr);
+ *array_ptr = *PG(http_globals)[TRACK_VARS_ENV];
+ INIT_PZVAL(array_ptr);
+ zval_copy_ctor(array_ptr);
+ return;
+ } else if (PG(http_globals)[TRACK_VARS_SERVER] &&
+ array_ptr != PG(http_globals)[TRACK_VARS_SERVER] &&
+ Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
+ zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0
+ ) {
+ zval_dtor(array_ptr);
+ *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER];
+ INIT_PZVAL(array_ptr);
+ zval_copy_ctor(array_ptr);
+ return;
+ }
+#endif
for (env = environ; env != NULL && *env != NULL; env++) {
p = strchr(*env, '=');
@@ -592,6 +615,9 @@ static int lsapi_module_main(int show_source TSRMLS_DC)
static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen,
void * arg )
{
+#if PHP_MAJOR_VERSION >= 7
+ zend_string * psKey;
+#endif
int type = ZEND_INI_PERDIR;
if ( '\001' == *pKey ) {
++pKey;
@@ -606,9 +632,19 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
engine = 0;
}
else
- zend_alter_ini_entry((char *)pKey, keyLen,
+ {
+#if PHP_MAJOR_VERSION >= 7
+ psKey = STR_INIT( pKey, keyLen, 1 );
+ zend_alter_ini_entry(psKey,
(char *)pValue, valLen,
type, PHP_INI_STAGE_ACTIVATE);
+ STR_RELEASE( psKey );
+#else
+ zend_alter_ini_entry((char *)pKey, keyLen,
+ (char *)pValue, valLen,
+ type, PHP_INI_STAGE_ACTIVATE);
+#endif
+ }
}
return 1;
}
@@ -749,6 +785,9 @@ static int cli_main( int argc, char * argv[] )
char ** argend= &argv[argc];
int ret = -1;
int c;
+#if PHP_MAJOR_VERSION >= 7
+ zend_string * psKey;
+#endif
lsapi_mode = 0; /* enter CLI mode */
#ifdef PHP_WIN32
@@ -763,12 +802,21 @@ static int cli_main( int argc, char * argv[] )
zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
CG(in_compilation) = 0; /* not initialized but needed for several options */
+#if PHP_MAJOR_VERSION < 7
EG(uninitialized_zval_ptr) = NULL;
-
+#endif
for( ini = ini_defaults; *ini; ini+=2 ) {
+#if PHP_MAJOR_VERSION >= 7
+ psKey = STR_INIT( *ini, strlen( *ini ), 1 );
+ zend_alter_ini_entry( psKey,
+ (char *)*(ini+1), strlen( *(ini+1) ),
+ PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ STR_RELEASE( psKey );
+#else
zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1,
(char *)*(ini+1), strlen( *(ini+1) ),
PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+#endif
}
while (( p < argend )&&(**p == '-' )) {
@@ -1148,7 +1196,11 @@ zend_module_entry litespeed_module_entry = {
static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen,
void * arg )
{
- add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue);
+ add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue
+#if PHP_MAJOR_VERSION < 7
+ , 1
+#endif
+ );
return 1;
}
@@ -1202,7 +1254,11 @@ PHP_FUNCTION(litespeed_response_headers)
headerBuf[len] = 0;
if ( len ) {
while( isspace(*++p));
- add_assoc_string_ex(return_value, headerBuf, len+1, p);
+ add_assoc_string_ex(return_value, headerBuf, len+1, p
+#if PHP_MAJOR_VERSION < 7
+ , 1
+#endif
+ );
}
}
}
@@ -1217,15 +1273,25 @@ PHP_FUNCTION(litespeed_response_headers)
Fetch all loaded module names */
PHP_FUNCTION(apache_get_modules)
{
+ static const char * mod_names[] =
+ {
+ "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL
+ };
+ const char **name = mod_names;
/* TODO: */
if (ZEND_NUM_ARGS() > 0) {
WRONG_PARAM_COUNT;
}
array_init(return_value);
- add_next_index_string(return_value, "mod_rewrite");
- add_next_index_string(return_value, "mod_mime");
- add_next_index_string(return_value, "mod_headers");
- add_next_index_string(return_value, "mod_expires");
+ while( *name )
+ {
+ add_next_index_string(return_value, *name
+#if PHP_MAJOR_VERSION < 7
+ , 1
+#endif
+ );
+ ++name;
+ }
}
/* }}} */
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index cf63f6ab1c..daf0f37f14 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -2662,7 +2662,7 @@ static void lsapi_check_child_status( long tmCur )
}
if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 )
{
- fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Childen: %d, count: %d, idle: %d, dying: %d\n", getpid(),
+ fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d, count: %d, idle: %d, dying: %d\n", getpid(),
g_prefork_server->m_iCurChildren, count, idle, dying );
}
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
index 812507957e..6bf4afb83d 100644
--- a/sapi/nsapi/nsapi-readme.txt
+++ b/sapi/nsapi/nsapi-readme.txt
@@ -1,7 +1,7 @@
Configuration of your Netscape/iPlanet/Sun Webserver for PHP7
-----------------------------------------------------------------
-These instructions are targetted at Netscape Enterprise Web Server and
+These instructions are targeted at Netscape Enterprise Web Server and
SUN/Netscape Alliance iPlanet Web Server and the new Sun Java System Webserver.
On other web servers your milage may vary.
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index ec65a22f12..c624669785 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1571,7 +1571,7 @@ phpdbg_out:
#ifdef _WIN32
} __except(phpdbg_exception_handler_win32(xp = GetExceptionInformation())) {
- phpdbg_error("segfault", "", "Access violation (Segementation fault) encountered\ntrying to abort cleanly...");
+ phpdbg_error("segfault", "", "Access violation (Segmentation fault) encountered\ntrying to abort cleanly...");
}
phpdbg_out:
#endif
diff --git a/sapi/phpdbg/xml.md b/sapi/phpdbg/xml.md
index 7871b31376..56dcaaa1f7 100644
--- a/sapi/phpdbg/xml.md
+++ b/sapi/phpdbg/xml.md
@@ -225,7 +225,7 @@ frame
- internal: has value "internal" when being an internal function call (one cannot inspect that frame)
- being an error: (by type)
- - maxnum: tried to access a frame with a number heigher than existing (or &lt; 0)
+ - maxnum: tried to access a frame with a number higher than existing (or &lt; 0)
### attributes on &lt;arg> ###
@@ -378,7 +378,7 @@ exec
- command executing and compiling a given file
- &lt;exec type="unset" context="" />: indicates unsetting of the old context
- &lt;exec type="unsetops" />: indicates unsetting of the old compiled opcodes
- - &lt;exec type="unchanged" />: same execution context choosen again
+ - &lt;exec type="unchanged" />: same execution context chosen again
- &lt;exec type="set" context="" />: indicates setting of the new context
- errors by tag
- &lt;compile>
@@ -527,7 +527,7 @@ set
### breaks ###
-- generally enables / disables breakpoint functionality silently with no futher xml answer
+- generally enables / disables breakpoint functionality silently with no further xml answer
- if the boolean switch is omitted, it emits current state in a &lt;setbreaks active="" /> where active is on or off
### color ###
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
index 1a9ed29d60..1463d8fe0a 100644
--- a/sapi/thttpd/thttpd_patch
+++ b/sapi/thttpd/thttpd_patch
@@ -2059,7 +2059,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
@@ -1519,7 +1697,7 @@
if ( c->bytes_sent >= c->bytes_to_send )
{
- /* This conection is finished! */
+ /* This connection is finished! */
- clear_connection( c, tvP );
+ clear_connection( c, tvP, 1 );
return;