From ac6bd1e3466c608792371494dbba4782083218cc Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 21 Jan 2014 12:13:42 -0800 Subject: 5.4.26 next --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index 213cd5386d..11791b14bd 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 25 +#define PHP_RELEASE_VERSION 26 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.25-dev" -#define PHP_VERSION_ID 50425 +#define PHP_VERSION "5.4.26-dev" +#define PHP_VERSION_ID 50426 -- cgit v1.2.1 From da84f3af751aa9bbf76bc22924a488f981d47088 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 29 Jan 2014 09:53:22 +0100 Subject: Fixed Request #66574 Allow multiple paths in php_ini_scanned_path php_ini_scanned_path, from --with-config-file-scan-dir option or from PHP_INI_SCAN_DIR environment variable allow a single path. In some case it could be useful to allow multiple. In the proposed patch, multiple paths are allow, using syntax inspired from Unix MANPATH (: separated list, empty string for builtin value). For example, this allow to use: PHP_INI_SCAN_DIR=/foo/php.d:/bar/php.d php PHP_INI_SCAN_DIR=:/myproject/php.d php PHP_INI_SCAN_DIR=/myproject/php.d: php Real use case: in SCL for dependent collections where each collection provides a separate tree for extensions, libraries and ini files. --- main/php_ini.c | 106 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 44 deletions(-) (limited to 'main') diff --git a/main/php_ini.c b/main/php_ini.c index 1faec6877d..e20ba4ba73 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -630,63 +630,81 @@ int php_init_config(TSRMLS_D) zend_llist scanned_ini_list; zend_llist_element *element; int l, total_l = 0; + char *bufpath, *debpath, *endpath; + int lenpath; - if ((ndir = php_scandir(php_ini_scanned_path, &namelist, 0, php_alphasort)) > 0) { - zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1); - memset(&fh2, 0, sizeof(fh2)); + zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1); + memset(&fh2, 0, sizeof(fh2)); - for (i = 0; i < ndir; i++) { + bufpath = estrdup(php_ini_scanned_path); + for (debpath = bufpath ; debpath ; debpath=endpath) { + endpath = strchr(debpath, DEFAULT_DIR_SEPARATOR); + if (endpath) { + *(endpath++) = 0; + } + if (!debpath[0]) { + /* empty string means default builtin value + to allow "/foo/phd.d:" or ":/foo/php.d" */ + debpath = PHP_CONFIG_FILE_SCAN_DIR; + } + lenpath = strlen(debpath); - /* check for any file with .ini extension */ - if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) { - free(namelist[i]); - continue; - } - /* Reset active ini section */ - RESET_ACTIVE_INI_HASH(); + if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_alphasort)) > 0) { - if (IS_SLASH(php_ini_scanned_path[php_ini_scanned_path_len - 1])) { - snprintf(ini_file, MAXPATHLEN, "%s%s", php_ini_scanned_path, namelist[i]->d_name); - } else { - snprintf(ini_file, MAXPATHLEN, "%s%c%s", php_ini_scanned_path, DEFAULT_SLASH, namelist[i]->d_name); - } - if (VCWD_STAT(ini_file, &sb) == 0) { - if (S_ISREG(sb.st_mode)) { - if ((fh2.handle.fp = VCWD_FOPEN(ini_file, "r"))) { - fh2.filename = ini_file; - fh2.type = ZEND_HANDLE_FP; - - if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) { - /* Here, add it to the list of ini files read */ - l = strlen(ini_file); - total_l += l + 2; - p = estrndup(ini_file, l); - zend_llist_add_element(&scanned_ini_list, &p); + for (i = 0; i < ndir; i++) { + + /* check for any file with .ini extension */ + if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) { + free(namelist[i]); + continue; + } + /* Reset active ini section */ + RESET_ACTIVE_INI_HASH(); + + if (IS_SLASH(debpath[lenpath - 1])) { + snprintf(ini_file, MAXPATHLEN, "%s%s", debpath, namelist[i]->d_name); + } else { + snprintf(ini_file, MAXPATHLEN, "%s%c%s", debpath, DEFAULT_SLASH, namelist[i]->d_name); + } + if (VCWD_STAT(ini_file, &sb) == 0) { + if (S_ISREG(sb.st_mode)) { + if ((fh2.handle.fp = VCWD_FOPEN(ini_file, "r"))) { + fh2.filename = ini_file; + fh2.type = ZEND_HANDLE_FP; + + if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) { + /* Here, add it to the list of ini files read */ + l = strlen(ini_file); + total_l += l + 2; + p = estrndup(ini_file, l); + zend_llist_add_element(&scanned_ini_list, &p); + } } } } + free(namelist[i]); } - free(namelist[i]); + free(namelist); } - free(namelist); + } + efree(bufpath); - if (total_l) { - int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; - php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); - if (!php_ini_scanned_files_len) { - *php_ini_scanned_files = '\0'; - } - total_l += php_ini_scanned_files_len; - for (element = scanned_ini_list.head; element; element = element->next) { - if (php_ini_scanned_files_len) { - strlcat(php_ini_scanned_files, ",\n", total_l); - } - strlcat(php_ini_scanned_files, *(char **)element->data, total_l); - strlcat(php_ini_scanned_files, element->next ? ",\n" : "\n", total_l); + if (total_l) { + int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; + php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); + if (!php_ini_scanned_files_len) { + *php_ini_scanned_files = '\0'; + } + total_l += php_ini_scanned_files_len; + for (element = scanned_ini_list.head; element; element = element->next) { + if (php_ini_scanned_files_len) { + strlcat(php_ini_scanned_files, ",\n", total_l); } + strlcat(php_ini_scanned_files, *(char **)element->data, total_l); + strlcat(php_ini_scanned_files, element->next ? ",\n" : "\n", total_l); } - zend_llist_destroy(&scanned_ini_list); } + zend_llist_destroy(&scanned_ini_list); } else { /* Make sure an empty php_ini_scanned_path ends up as NULL */ php_ini_scanned_path = NULL; -- cgit v1.2.1 From cbd108abf19d9fb9ae1d4ccd153215f56a2763e8 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Thu, 13 Feb 2014 11:54:52 +0900 Subject: Implement RFC https://wiki.php.net/rfc/default_encoding --- main/SAPI.h | 3 ++- main/main.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- main/php.h | 1 + main/php_globals.h | 4 ++++ 4 files changed, 51 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/SAPI.h b/main/SAPI.h index a2158a9590..990ca6990c 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -21,6 +21,7 @@ #ifndef SAPI_H #define SAPI_H +#include "php.h" #include "zend.h" #include "zend_API.h" #include "zend_llist.h" @@ -291,7 +292,7 @@ struct _sapi_post_entry { #define SAPI_HEADER_SEND_FAILED 3 #define SAPI_DEFAULT_MIMETYPE "text/html" -#define SAPI_DEFAULT_CHARSET "" +#define SAPI_DEFAULT_CHARSET PHP_DEFAULT_CHARSET #define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION #define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D) diff --git a/main/main.c b/main/main.c index 2d59c46930..abe032af70 100644 --- a/main/main.c +++ b/main/main.c @@ -415,6 +415,45 @@ static PHP_INI_DISP(display_errors_mode) } /* }}} */ +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateInternalEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateInputEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateOutputEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + /* {{{ PHP_INI_MH */ static PHP_INI_MH(OnUpdateErrorLog) @@ -556,8 +595,11 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_append_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_prepend_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals) - STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals) + STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals) + STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals) + STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals) STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals) diff --git a/main/php.h b/main/php.h index 8f8ad33d87..4330479d50 100644 --- a/main/php.h +++ b/main/php.h @@ -29,6 +29,7 @@ #define PHP_API_VERSION 20131106 #define PHP_HAVE_STREAMS #define YYDEBUG 0 +#define PHP_DEFAULT_CHARSET "UTF-8" #include "php_version.h" #include "zend.h" diff --git a/main/php_globals.h b/main/php_globals.h index cf7998b83d..e135d61865 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -96,6 +96,10 @@ struct _php_core_globals { char *auto_prepend_file; char *auto_append_file; + char *input_encoding; + char *internal_encoding; + char *output_encoding; + arg_separators arg_separator; char *variables_order; -- cgit v1.2.1 From c612440e0f50eea166bb8dfd375d5f848f8711f7 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 17 Feb 2014 21:19:25 -0800 Subject: 5.4.27 now --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index 11791b14bd..f887b489ac 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 26 +#define PHP_RELEASE_VERSION 27 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.26-dev" -#define PHP_VERSION_ID 50426 +#define PHP_VERSION "5.4.27-dev" +#define PHP_VERSION_ID 50427 -- cgit v1.2.1 From 0afcbb0ba9335d90e5b1f07d77bd00a97b1b426b Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Tue, 18 Feb 2014 16:45:48 +0100 Subject: 5.5.11-dev next --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index 784ef62e41..34f51281fa 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 5 -#define PHP_RELEASE_VERSION 9 +#define PHP_RELEASE_VERSION 11 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.5.9-dev" -#define PHP_VERSION_ID 50509 +#define PHP_VERSION "5.5.11-dev" +#define PHP_VERSION_ID 50511 -- cgit v1.2.1 From 3a9829af2062527fb4e5cb11eb4ac3e045d0b370 Mon Sep 17 00:00:00 2001 From: Daniel Lowrey Date: Tue, 11 Feb 2014 08:12:01 -0700 Subject: Use crypto method flags; add tlsv1.0 wrapper; add wrapper tests --- main/streams/php_stream_transport.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'main') diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index c599a65d0f..dc10eb4e92 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -163,23 +163,30 @@ typedef struct _php_stream_xport_param { } outputs; } php_stream_xport_param; - -/* These functions provide crypto support on the underlying transport */ +/* Because both client and server streams use the same mechanisms + for encryption we use the LSB to denote clients. +*/ typedef enum { - STREAM_CRYPTO_METHOD_SSLv2_CLIENT, - STREAM_CRYPTO_METHOD_SSLv3_CLIENT, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, - STREAM_CRYPTO_METHOD_TLS_CLIENT, - STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, - STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, - STREAM_CRYPTO_METHOD_SSLv2_SERVER, - STREAM_CRYPTO_METHOD_SSLv3_SERVER, - STREAM_CRYPTO_METHOD_SSLv23_SERVER, - STREAM_CRYPTO_METHOD_TLS_SERVER, - STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, - STREAM_CRYPTO_METHOD_TLSv1_2_SERVER + STREAM_CRYPTO_METHOD_SSLv2_CLIENT = (1 << 1 | 1), + STREAM_CRYPTO_METHOD_SSLv3_CLIENT = (1 << 2 | 1), + STREAM_CRYPTO_METHOD_SSLv23_CLIENT = ((1 << 1) | (1 << 2) | 1), + STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT = (1 << 3 | 1), + STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT = (1 << 4 | 1), + STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT = (1 << 5 | 1), + STREAM_CRYPTO_METHOD_TLS_CLIENT = ((1 << 3) | (1 << 4) | (1 << 5) | 1), + STREAM_CRYPTO_METHOD_ANY_CLIENT = ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | 1), + STREAM_CRYPTO_METHOD_SSLv2_SERVER = (1 << 1), + STREAM_CRYPTO_METHOD_SSLv3_SERVER = (1 << 2), + STREAM_CRYPTO_METHOD_SSLv23_SERVER = ((1 << 1) | (1 << 2)), + STREAM_CRYPTO_METHOD_TLSv1_0_SERVER = (1 << 3), + STREAM_CRYPTO_METHOD_TLSv1_1_SERVER = (1 << 4), + STREAM_CRYPTO_METHOD_TLSv1_2_SERVER = (1 << 5), + STREAM_CRYPTO_METHOD_TLS_SERVER = ((1 << 3) | (1 << 4) | (1 << 5)), + STREAM_CRYPTO_METHOD_ANY_SERVER = ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5)) } php_stream_xport_crypt_method_t; +/* These functions provide crypto support on the underlying transport */ + BEGIN_EXTERN_C() PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC); PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC); -- cgit v1.2.1 From 62f6c5853f87259de320c54d12f7fb213aee4e27 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 19 Mar 2014 06:26:54 +0100 Subject: Fixes to various stream cast on win64 This fixes further issues on win64 with casts from the streams. Sockets/descriptors handling was unitized. This has an impact only on win64, php_socket_t otherwise can be feed back to int datatype. --- main/streams/plain_wrapper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'main') diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 6ddfc74a11..5e9e5c7ace 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -482,7 +482,7 @@ static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t * static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) { - int fd; + php_socket_t fd; php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; assert(data != NULL); @@ -506,31 +506,31 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) } *(FILE**)ret = data->file; - data->fd = -1; + data->fd = SOCK_ERR; } return SUCCESS; case PHP_STREAM_AS_FD_FOR_SELECT: PHP_STDIOP_GET_FD(fd, data); - if (fd < 0) { + if (SOCK_ERR == fd) { return FAILURE; } if (ret) { - *(int*)ret = fd; + *(php_socket_t *)ret = fd; } return SUCCESS; case PHP_STREAM_AS_FD: PHP_STDIOP_GET_FD(fd, data); - if (fd < 0) { + if (SOCK_ERR == fd) { return FAILURE; } if (data->file) { fflush(data->file); } if (ret) { - *(int*)ret = fd; + *(php_socket_t *)ret = fd; } return SUCCESS; default: -- cgit v1.2.1 From 9b88bc494e5e749039bd0166723b6b0a35de5a3e Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 18 Mar 2014 23:14:18 -0700 Subject: prep for 5.4.27 rc1 --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index f887b489ac..fee0803878 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 27 +#define PHP_RELEASE_VERSION 28 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.27-dev" -#define PHP_VERSION_ID 50427 +#define PHP_VERSION "5.4.28-dev" +#define PHP_VERSION_ID 50428 -- cgit v1.2.1 From c4145619be0b98bb77e2ec25aebbb1a251d5438d Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Wed, 19 Mar 2014 10:43:32 +0100 Subject: 5.5.11RC1 preparation --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index 34f51281fa..08058032fc 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 5 -#define PHP_RELEASE_VERSION 11 +#define PHP_RELEASE_VERSION 12 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.5.11-dev" -#define PHP_VERSION_ID 50511 +#define PHP_VERSION "5.5.12-dev" +#define PHP_VERSION_ID 50512 -- cgit v1.2.1 From a84e5dc37dc0ff8c313164d9db141d3d9f2b2730 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Mon, 24 Mar 2014 11:04:35 +0900 Subject: Remove unneeded string copy. Allow to set ''(empty string values) internal/input/output_encoding for better compatibility. i.e. Runtime INI value changes. More compliance to the RFC. Improve/add encoding handling tests. i.e. Rather than set encoding automagic way, detect it. --- main/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'main') diff --git a/main/main.c b/main/main.c index abe032af70..60f5a16c4b 100644 --- a/main/main.c +++ b/main/main.c @@ -419,7 +419,7 @@ static PHP_INI_DISP(display_errors_mode) */ static PHP_INI_MH(OnUpdateInternalEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -432,7 +432,7 @@ static PHP_INI_MH(OnUpdateInternalEncoding) */ static PHP_INI_MH(OnUpdateInputEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -445,7 +445,7 @@ static PHP_INI_MH(OnUpdateInputEncoding) */ static PHP_INI_MH(OnUpdateOutputEncoding) { - if (new_value_length) { + if (new_value) { OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); @@ -597,9 +597,9 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals) STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals) - STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("internal_encoding", NULL, PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("input_encoding", NULL, PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_encoding", NULL, PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals) STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals) -- cgit v1.2.1 From 91a9d24aa30507e6c7d8937db2de24394f0ce121 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 2 Apr 2014 11:09:26 +0200 Subject: Fix bug #64330 stream_socket_server() creates wrong Abstract Namespace UNIX sockets --- main/streams/xp_socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 2c7ca8d414..53f0769a1c 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -588,7 +588,8 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * parse_unix_address(xparam, &unix_addr TSRMLS_CC); - return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr)); + return bind(sock->socket, (const struct sockaddr *)&unix_addr, + (socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen); } #endif -- cgit v1.2.1 From 1ec83d44a1601c3560f430e08af9698bf8fb075c Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 2 Apr 2014 15:36:39 +0200 Subject: Fixed bug #61019 (Out of memory on command stream_get_contents) --- main/streams/streams.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main') diff --git a/main/streams/streams.c b/main/streams/streams.c index cac50ef03f..acc67dc207 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -736,6 +736,10 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) { toread = stream->ops->read(stream, buf, size TSRMLS_CC); + if (toread == (size_t) -1) { + /* e.g. underlying read(2) returned -1 */ + break; + } } else { php_stream_fill_read_buffer(stream, size TSRMLS_CC); -- cgit v1.2.1 From d08b4dbf23febd3f305a2682b03ab9c70f11ac60 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 3 Apr 2014 10:40:06 +0200 Subject: Fix Bug #66736 fpassthru broken --- main/output.c | 14 ++++++++++++++ main/streams/streams.c | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/output.c b/main/output.c index 0777b64e1d..e0d33d751f 100644 --- a/main/output.c +++ b/main/output.c @@ -234,6 +234,13 @@ PHPAPI int php_output_get_status(TSRMLS_D) * Unbuffered write */ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) { +#if PHP_DEBUG + if (len > UINT_MAX) { + php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; " + "output will be truncated %lu => %lu", + (unsigned long) len, (unsigned long) (len % UINT_MAX)); + } +#endif if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } @@ -248,6 +255,13 @@ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) * Buffered write */ PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC) { +#if PHP_DEBUG + if (len > UINT_MAX) { + php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; " + "output will be truncated %lu => %lu", + (unsigned long) len, (unsigned long) (len % UINT_MAX)); + } +#endif if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } diff --git a/main/streams/streams.c b/main/streams/streams.c index acc67dc207..12833771c0 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1405,11 +1405,16 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); if (p) { - PHPWRITE(p, mapped); + do { + /* output functions return int, so pass in int max */ + if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) { + bcount += b; + } + } while (b > 0 && mapped > bcount); php_stream_mmap_unmap_ex(stream, mapped); - return mapped; + return bcount; } } -- cgit v1.2.1 From edd90e5ae3157cb64ebea5940574d846590b26fa Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 12 Apr 2014 23:50:47 +0200 Subject: Made usage of php_hash_environment useful by updating instead of just adding argc --- main/php_variables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main') diff --git a/main/php_variables.c b/main/php_variables.c index e9ec0789bc..7cc2baa988 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -519,7 +519,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) Z_ADDREF_P(arr); Z_ADDREF_P(argc); zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL); - zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL); + zend_hash_update(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL); } if (track_vars_array) { Z_ADDREF_P(arr); -- cgit v1.2.1 From 5a0da281e5a9fa02db18b4822d8b103c65849fa9 Mon Sep 17 00:00:00 2001 From: Ferenc Kovacs Date: Sun, 13 Apr 2014 01:55:55 +0200 Subject: fix typo --- main/SAPI.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main') diff --git a/main/SAPI.c b/main/SAPI.c index 6890db3e65..f02bca6d1d 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -717,7 +717,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) header_line = estrndup(header_line, header_line_len); - /* cut of trailing spaces, linefeeds and carriage-returns */ + /* cut off trailing spaces, linefeeds and carriage-returns */ if (header_line_len && isspace(header_line[header_line_len-1])) { do { header_line_len--; -- cgit v1.2.1 From b8d029435dd436487a455a758e8dc10d1c94096e Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Tue, 15 Apr 2014 17:57:27 +0200 Subject: 5.5.12RC1 setup --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index 08058032fc..4574767493 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 5 -#define PHP_RELEASE_VERSION 12 +#define PHP_RELEASE_VERSION 13 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.5.12-dev" -#define PHP_VERSION_ID 50512 +#define PHP_VERSION "5.5.13-dev" +#define PHP_VERSION_ID 50513 -- cgit v1.2.1 From 1d34d822315a97bb7d3eeb3b9e75f34807ac4a12 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 15 Apr 2014 16:51:38 -0700 Subject: 5.4.29 is next --- main/php_version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/php_version.h b/main/php_version.h index fee0803878..f1cdb59c65 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 28 +#define PHP_RELEASE_VERSION 29 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.28-dev" -#define PHP_VERSION_ID 50428 +#define PHP_VERSION "5.4.29-dev" +#define PHP_VERSION_ID 50429 -- cgit v1.2.1 From a18cec1b865994735e5b4ab757ccc1a14f8607ff Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Mon, 14 Apr 2014 10:02:11 +0200 Subject: Fix bug #65701: Do not use cache for file file copy --- main/php_streams.h | 1 + main/streams/streams.c | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 22 deletions(-) (limited to 'main') diff --git a/main/php_streams.h b/main/php_streams.h index f3c9879144..2e4a3a2a18 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -377,6 +377,7 @@ END_EXTERN_C() /* Flags for url_stat method in wrapper ops */ #define PHP_STREAM_URL_STAT_LINK 1 #define PHP_STREAM_URL_STAT_QUIET 2 +#define PHP_STREAM_URL_STAT_NOCACHE 4 /* change the blocking mode of stream: value == 1 => blocking, value == 0 => non-blocking. */ #define PHP_STREAM_OPTION_BLOCKING 1 diff --git a/main/streams/streams.c b/main/streams/streams.c index 12833771c0..3fd4ab3796 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1929,16 +1929,18 @@ PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, char *path_to_open = path; int ret; - /* Try to hit the cache first */ - if (flags & PHP_STREAM_URL_STAT_LINK) { - if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { - memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); - return 0; - } - } else { - if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { - memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); - return 0; + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { + /* Try to hit the cache first */ + if (flags & PHP_STREAM_URL_STAT_LINK) { + if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { + memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); + return 0; + } + } else { + if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { + memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); + return 0; + } } } @@ -1946,19 +1948,21 @@ PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, if (wrapper && wrapper->wops->url_stat) { ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); if (ret == 0) { - /* Drop into cache */ - if (flags & PHP_STREAM_URL_STAT_LINK) { - if (BG(CurrentLStatFile)) { - efree(BG(CurrentLStatFile)); - } - BG(CurrentLStatFile) = estrdup(path); - memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); - } else { - if (BG(CurrentStatFile)) { - efree(BG(CurrentStatFile)); + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { + /* Drop into cache */ + if (flags & PHP_STREAM_URL_STAT_LINK) { + if (BG(CurrentLStatFile)) { + efree(BG(CurrentLStatFile)); + } + BG(CurrentLStatFile) = estrdup(path); + memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); + } else { + if (BG(CurrentStatFile)) { + efree(BG(CurrentStatFile)); + } + BG(CurrentStatFile) = estrdup(path); + memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); } - BG(CurrentStatFile) = estrdup(path); - memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); } } return ret; -- cgit v1.2.1 From 03be983398b75fdc147406e73a5d0dddd4533c08 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 24 Apr 2014 10:51:42 +0200 Subject: fix dll export --- main/php_variables.c | 2 +- main/php_variables.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/php_variables.c b/main/php_variables.c index 7cc2baa988..be6448e5a3 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -636,7 +636,7 @@ static zend_bool php_auto_globals_create_request(const char *name, uint name_len /* {{{ php_hash_environment */ -int php_hash_environment(TSRMLS_D) +PHPAPI int php_hash_environment(TSRMLS_D) { memset(PG(http_globals), 0, sizeof(PG(http_globals))); zend_activate_auto_globals(TSRMLS_C); diff --git a/main/php_variables.h b/main/php_variables.h index 37b2cf2a04..2331c582e6 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -41,7 +41,7 @@ PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array T PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); -int php_hash_environment(TSRMLS_D); +PHPAPI int php_hash_environment(TSRMLS_D); END_EXTERN_C() #define NUM_TRACK_VARS 6 -- cgit v1.2.1