diff options
| author | Rasmus Lerdorf <rasmus@php.net> | 2014-10-16 21:27:49 -0700 |
|---|---|---|
| committer | Rasmus Lerdorf <rasmus@php.net> | 2014-10-16 21:27:49 -0700 |
| commit | 0d27b3ea698dbed6b1235f01d82984567aa2b569 (patch) | |
| tree | 26e4a71225eceecd27433508c6b8b4dafea94541 /sapi | |
| parent | 03797a73b25996315b6c6ce606a9d8724439699e (diff) | |
| parent | a3beb42ded9d1c016c7f14b66ce6008309b506ec (diff) | |
| download | php-git-0d27b3ea698dbed6b1235f01d82984567aa2b569.tar.gz | |
Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6
* 'PHP-5.6' of git.php.net:php-src: (129 commits)
NEWS
cleanup NEWS
removing the NEWS entry as we had to revert this fix for now
Revert "Merge branch 'PHP-5.5' into PHP-5.6"
Revert "fix TS build"
Revert "Merge branch 'PHP-5.4' into PHP-5.5"
Revert "Bug #67965: Fix blocking behavior in non-blocking crypto streams"
Revert "Bug #41631: Fix regression from first attempt (6569db8)"
NEWS
Fixed Bug #65171 imagescale() fails
Fixed bug #68234
Revert "Bug #41631: Observe socket read timeouts in SSL streams"
PHP-5.6.3 is next
update NEWS, 5.6.2 will be a security-only release
Fix return code (merges are hard :( )
Fix bug #68113 (Heap corruption in exif_thumbnail())
Fix bug #68089 - do not accept options with embedded \0
Fixed bug #68044: Integer overflow in unserialize() (32-bits only)
Fix bug #68027 - fix date parsing in XMLRPC lib
Fix bug #68113 (Heap corruption in exif_thumbnail())
...
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/cgi/fastcgi.c | 4 | ||||
| -rw-r--r-- | sapi/cli/tests/016.phpt | 2 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 11 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_sockets.c | 85 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_sockets.h | 6 | ||||
| -rw-r--r-- | sapi/fpm/php-fpm.conf.in | 2 | ||||
| -rw-r--r-- | sapi/fpm/tests/003.phpt | 53 | ||||
| -rw-r--r-- | sapi/litespeed/lsapi_main.c | 6 | ||||
| -rw-r--r-- | sapi/phpdbg/.travis.yml | 1 | ||||
| -rw-r--r-- | sapi/phpdbg/README.md | 2 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg.c | 10 |
11 files changed, 121 insertions, 61 deletions
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 8ddc2e4577..6133668306 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -1112,7 +1112,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy) shutdown(req->fd, 1); /* read the last FCGI_STDIN header (it may be omitted) */ - recv(req->fd, &buf, sizeof(buf), 0); + recv(req->fd, (char *)(&buf), sizeof(buf), 0); } closesocket(req->fd); } @@ -1122,7 +1122,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy) shutdown(req->fd, 1); /* read the last FCGI_STDIN header (it may be omitted) */ - recv(req->fd, &buf, sizeof(buf), 0); + recv(req->fd, (char *)(&buf), sizeof(buf), 0); } close(req->fd); #endif diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt index 31c1a40e4a..9c28d15a30 100644 --- a/sapi/cli/tests/016.phpt +++ b/sapi/cli/tests/016.phpt @@ -59,8 +59,6 @@ foreach ($codes as $key => $code) { echo "\nDone\n"; ?> ---XFAIL-- -https://bugs.php.net/bug.php?id=55496 --EXPECTF-- -------------- Snippet no. 1: diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index cd5492d73d..5b96dee038 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1237,6 +1237,17 @@ static void init_request_info(TSRMLS_D) SG(request_info).request_uri = orig_script_name; } path_info[0] = old; + } else if (apache_was_here && env_script_name) { + /* Using mod_proxy_fcgi and ProxyPass, apache cannot set PATH_INFO + * As we can extract PATH_INFO from PATH_TRANSLATED + * it is probably also in SCRIPT_NAME and need to be removed + */ + int snlen = strlen(env_script_name); + if (snlen>slen && !strcmp(env_script_name+snlen-slen, path_info)) { + _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC); + env_script_name[snlen-slen] = 0; + SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC); + } } env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC); } diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index e056565ea4..da14d63d8c 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -39,29 +39,6 @@ struct listening_socket_s { static struct fpm_array_s sockets_list; -static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockaddr_in *addr) /* {{{ */ -{ - struct addrinfo *res; - struct addrinfo hints; - int ret; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET; - ret = getaddrinfo(node, service, &hints, &res); - - if (ret != 0) { - zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n", - node, service ? ":" : "", service ? service : "", - gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : ""); - return -1; - } - - *addr = *(struct sockaddr_in *) res->ai_addr; - freeaddrinfo(res); - return 0; -} -/* }}} */ - enum { FPM_GET_USE_SOCKET = 1, FPM_STORE_SOCKET = 2, FPM_STORE_USE_SOCKET = 3 }; static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */ @@ -98,14 +75,23 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */ } /* }}} */ +static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */ +{ + if (sa->sa_family == AF_INET) { + return &(((struct sockaddr_in*)sa)->sin_addr); + } + + return &(((struct sockaddr_in6*)sa)->sin6_addr); +} +/* }}} */ + static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */ { if (key == NULL) { switch (type) { case FPM_AF_INET : { - struct sockaddr_in *sa_in = (struct sockaddr_in *) sa; - key = alloca(sizeof("xxx.xxx.xxx.xxx:ppppp")); - sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port)); + key = alloca(INET6_ADDRSTRLEN); + inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key); break; } @@ -254,11 +240,14 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *address) /* {{{ */ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* {{{ */ { - struct sockaddr_in sa_in; + struct addrinfo hints, *servinfo, *p; char *dup_address = strdup(wp->config->listen_address); - char *port_str = strchr(dup_address, ':'); + char *port_str = strrchr(dup_address, ':'); char *addr = NULL; + int addr_len; int port = 0; + int sock; + int status; if (port_str) { /* this is host:port pair */ *port_str++ = '\0'; @@ -274,23 +263,35 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* return -1; } - memset(&sa_in, 0, sizeof(sa_in)); - - if (addr) { - sa_in.sin_addr.s_addr = inet_addr(addr); - if (sa_in.sin_addr.s_addr == INADDR_NONE) { /* do resolve */ - if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) { - return -1; - } - zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr)); + // strip brackets from address for getaddrinfo + if (addr != NULL) { + addr_len = strlen(addr); + if (addr[0] == '[' && addr[addr_len - 1] == ']') { + addr[addr_len - 1] = '\0'; + addr++; } - } else { - sa_in.sin_addr.s_addr = htonl(INADDR_ANY); } - sa_in.sin_family = AF_INET; - sa_in.sin_port = htons(port); + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + if ((status = getaddrinfo(addr, port_str, &hints, &servinfo)) != 0) { + zlog(ZLOG_ERROR, "getaddrinfo: %s\n", gai_strerror(status)); + return -1; + } + free(dup_address); - return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in)); + + for (p = servinfo; p != NULL; p = p->ai_next) { + if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) { + break; + } + } + + freeaddrinfo(servinfo); + + return sock; } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 121c016a7b..446c78e410 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -45,10 +45,4 @@ static inline int fd_set_blocked(int fd, int blocked) /* {{{ */ } /* }}} */ -#define IPQUAD(sin_addr) \ - (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[0], \ - (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[1], \ - (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[2], \ - (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3] - #endif diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index c5f4abc59c..631bc46f42 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -152,6 +152,8 @@ group = @php_fpm_group@ ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; 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 addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt new file mode 100644 index 0000000000..389cb2401e --- /dev/null +++ b/sapi/fpm/tests/003.phpt @@ -0,0 +1,53 @@ +--TEST-- +FPM: Test IPv6 support +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$logfile = dirname(__FILE__).'/php-fpm.log.tmp'; + +$cfg = <<<EOT +[global] +error_log = $logfile +[unconfined] +listen = [::1]:9000 +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +EOT; + +$fpm = run_fpm($cfg, $tail); +if (is_resource($fpm)) { + var_dump(fgets($tail)); + var_dump(fgets($tail)); + $i = 0; + while (($i++ < 30) && !($fp = fsockopen('[::1]', 9000))) { + usleep(10000); + } + if ($fp) { + echo "Done\n"; + fclose($fp); + } + proc_terminate($fpm); + stream_get_contents($tail); + fclose($tail); + proc_close($fpm); +} + +?> +--EXPECTF-- +string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d +" +string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections +" +Done +--CLEAN-- +<?php + $logfile = dirname(__FILE__).'/php-fpm.log.tmp'; + @unlink($logfile); +?> diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index cb7c66b44a..425d638f9e 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -69,7 +69,7 @@ #define SAPI_LSAPI_MAX_HEADER_LENGTH 2048 -static int lsapi_mode = 1; +static int lsapi_mode = 0; static char *php_self = ""; static char *script_filename = ""; static int source_highlight = 0; @@ -311,6 +311,8 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC) if ( (SG(request_info).request_uri ) ) php_self = (SG(request_info).request_uri ); + litespeed_php_import_environment_variables(track_vars_array TSRMLS_CC); + #if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5) if (!PG(magic_quotes_gpc)) { #endif @@ -324,7 +326,6 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC) add_variable_magic_quote("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array ); } #endif - litespeed_php_import_environment_variables(track_vars_array TSRMLS_CC); } else { php_import_environment_variables(track_vars_array TSRMLS_CC); @@ -1052,6 +1053,7 @@ int main( int argc, char * argv[] ) LSAPI_Init(); LSAPI_Init_Env_Parameters( NULL ); + lsapi_mode = 1; slow_script_msec = LSAPI_Get_Slow_Req_Msecs(); diff --git a/sapi/phpdbg/.travis.yml b/sapi/phpdbg/.travis.yml index d5b492e7cf..2e777fbe13 100644 --- a/sapi/phpdbg/.travis.yml +++ b/sapi/phpdbg/.travis.yml @@ -4,7 +4,6 @@ env: - PHP="PHP-5.4" - PHP="PHP-5.5" - PHP="PHP-5.6" -- PHP="master" before_script: ./travis/ci.sh diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md index e7e5c731a8..a2a84deb7b 100644 --- a/sapi/phpdbg/README.md +++ b/sapi/phpdbg/README.md @@ -1,7 +1,7 @@ The interactive PHP debugger ============================ -Implemented as a SAPI module, phpdbg can excert complete control over the environment without impacting the functionality or performance of your code. +Implemented as a SAPI module, phpdbg can exert complete control over the environment without impacting the functionality or performance of your code. phpdbg aims to be a lightweight, powerful, easy to use debugging platform for PHP 5.4+ diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 1fbd18a423..c881559e6e 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -1296,14 +1296,14 @@ phpdbg_main: /* do not install sigint handlers for remote consoles */ /* sending SIGINT then provides a decent way of shutting down the server */ -#if defined(ZEND_SIGNALS) && !defined(_WIN32) - if (listen[0] < 0) { - zend_try { zend_signal(SIGINT, phpdbg_sigint_handler TSRMLS_CC); } zend_end_try(); - } -#elif !defined(_WIN32) +#ifndef _WIN32 if (listen[0] < 0) { #endif +#if defined(ZEND_SIGNALS) && !defined(_WIN32) + zend_try { zend_signal(SIGINT, phpdbg_sigint_handler TSRMLS_CC); } zend_end_try(); +#else signal(SIGINT, phpdbg_sigint_handler); +#endif #ifndef _WIN32 } #endif |
