diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-01-07 13:31:53 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-01-07 13:31:53 +0100 |
| commit | 0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch) | |
| tree | 91f01b0d06916c78262404096bfd466b8e95e5b5 /main | |
| parent | d3a8757891280dc6650ca7eead67830c794b0e7b (diff) | |
| download | php-upstream/5.3.1.tar.gz | |
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'main')
75 files changed, 279 insertions, 258 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index f13bab533..a4a8ed787 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.c,v 1.202.2.7.2.15.2.7 2009/04/28 21:30:23 stas Exp $ */ +/* $Id: SAPI.c 287423 2009-08-17 17:30:32Z jani $ */ #include <ctype.h> #include <sys/stat.h> @@ -32,9 +32,6 @@ #if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) #include "ext/pcre/php_pcre.h" #endif -#if HAVE_ZLIB -#include "ext/zlib/php_zlib.h" -#endif #ifdef ZTS #include "TSRM.h" #endif @@ -637,11 +634,12 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) ptr++; len--; } -#if HAVE_ZLIB - if(!strncmp(ptr, "image/", sizeof("image/")-1)) { + + /* Disable possible output compression for images */ + if (!strncmp(ptr, "image/", sizeof("image/")-1)) { zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } -#endif + mimetype = estrdup(ptr); newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC); if (!SG(sapi_headers).mimetype){ @@ -789,36 +787,6 @@ SAPI_API int sapi_send_headers(TSRMLS_D) return SUCCESS; } -#if HAVE_ZLIB - /* Add output compression headers at this late stage in order to make - it possible to switch it off inside the script. */ - - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { - zval nm_zlib_get_coding_type; - zval *uf_result = NULL; - - ZVAL_STRINGL(&nm_zlib_get_coding_type, "zlib_get_coding_type", sizeof("zlib_get_coding_type") - 1, 0); - - if (call_user_function_ex(CG(function_table), NULL, &nm_zlib_get_coding_type, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE && uf_result != NULL && Z_TYPE_P(uf_result) == IS_STRING) { - char buf[128]; - int len; - - assert(Z_STRVAL_P(uf_result) != NULL); - - len = slprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result)); - if (len <= 0 || sapi_add_header(buf, len, 1) == FAILURE) { - return FAILURE; - } - if (sapi_add_header_ex("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1, 0 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - } - if (uf_result != NULL) { - zval_ptr_dtor(&uf_result); - } - } -#endif - /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop * in case of an error situation. */ diff --git a/main/SAPI.h b/main/SAPI.h index 3b96d70ab..b978bc438 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.h,v 1.114.2.1.2.3.2.8 2009/04/28 21:30:23 stas Exp $ */ +/* $Id: SAPI.h 279522 2009-04-28 21:30:23Z stas $ */ #ifndef SAPI_H #define SAPI_H diff --git a/main/alloca.c b/main/alloca.c index ea7885621..2fb937021 100644 --- a/main/alloca.c +++ b/main/alloca.c @@ -21,7 +21,7 @@ allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ -/* $Id: alloca.c,v 1.8 2005/01/09 21:05:06 sniper Exp $ */ +/* $Id: alloca.c 242949 2007-09-26 15:44:16Z cvs2svn $ */ #include <php_config.h> diff --git a/main/build-defs.h.in b/main/build-defs.h.in index 2f280e52f..5be687988 100644 --- a/main/build-defs.h.in +++ b/main/build-defs.h.in @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: build-defs.h.in,v 1.15.2.2.2.2.2.1 2008/03/25 02:00:26 sixd Exp $ */ +/* $Id: build-defs.h.in 256027 2008-03-25 02:00:32Z sixd $ */ #define CONFIGURE_COMMAND "@CONFIGURE_COMMAND@" #define PHP_ADA_INCLUDE "" diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 91a1685cf..3d65c85d7 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.c,v 1.175.2.3.2.13.2.19 2009/06/18 06:38:30 rasmus Exp $ */ +/* $Id: fopen_wrappers.c 289428 2009-10-09 17:03:56Z pajoye $ */ /* {{{ includes */ @@ -93,7 +93,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir) p = (char **) (base + (size_t) mh_arg1); - if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) { + if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) { /* We're in a PHP_INI_SYSTEM context, no restrictions */ *p = new_value; return SUCCESS; @@ -382,9 +382,12 @@ static FILE *php_fopen_and_set_opened_path(const char *path, const char *mode, c */ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) { + FILE *fp; +#ifndef PHP_WIN32 + struct stat st; +#endif char *path_info, *filename; int length; - zend_bool orig_display_errors; filename = SG(request_info).path_translated; path_info = SG(request_info).request_uri; @@ -451,7 +454,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) } } /* if doc_root && path_info */ - if(filename) { + if (filename) { filename = zend_resolve_path(filename, strlen(filename) TSRMLS_CC); } @@ -463,20 +466,32 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) STR_FREE(SG(request_info).path_translated); SG(request_info).path_translated = NULL; return FAILURE; - } else { - STR_FREE(SG(request_info).path_translated); - SG(request_info).path_translated = filename; } + fp = VCWD_FOPEN(filename, "rb"); + +#ifndef PHP_WIN32 + /* refuse to open anything that is not a regular file */ + if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) { + fclose(fp); + fp = NULL; + } +#endif - orig_display_errors = PG(display_errors); - PG(display_errors) = 0; - if (zend_stream_open(filename, file_handle TSRMLS_CC) == FAILURE) { - PG(display_errors) = orig_display_errors; + if (!fp) { STR_FREE(SG(request_info).path_translated); /* for same reason as above */ SG(request_info).path_translated = NULL; return FAILURE; } - PG(display_errors) = orig_display_errors; + + file_handle->opened_path = expand_filepath(filename, NULL TSRMLS_CC); + + STR_FREE(SG(request_info).path_translated); /* for same reason as above */ + SG(request_info).path_translated = filename; + + file_handle->filename = SG(request_info).path_translated; + file_handle->free_filename = 0; + file_handle->handle.fp = fp; + file_handle->type = ZEND_HANDLE_FP; return SUCCESS; } diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index e62440496..36db81594 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.h,v 1.44.2.1.2.2.2.7 2009/01/16 10:06:10 pajoye Exp $ */ +/* $Id: fopen_wrappers.h 273621 2009-01-16 10:06:10Z pajoye $ */ #ifndef FOPEN_WRAPPERS_H #define FOPEN_WRAPPERS_H diff --git a/main/getopt.c b/main/getopt.c index 2c5350c10..3eb9ecfb8 100644 --- a/main/getopt.c +++ b/main/getopt.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: getopt.c,v 1.1.2.5 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: getopt.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include <stdio.h> #include <string.h> diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in index 2a3914d4d..b0f9ef6b8 100644 --- a/main/internal_functions.c.in +++ b/main/internal_functions.c.in @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: internal_functions.c.in,v 1.30.2.1.2.2.2.1 2008/08/22 12:59:46 helly Exp $ */ +/* $Id: internal_functions.c.in 265279 2008-08-22 12:59:46Z helly $ */ #include "php.h" #include "php_main.h" diff --git a/main/internal_functions_nw.c b/main/internal_functions_nw.c index f20f134ac..da63dd4ae 100644 --- a/main/internal_functions_nw.c +++ b/main/internal_functions_nw.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: internal_functions_nw.c,v 1.9.2.1.2.2.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: internal_functions_nw.c 272370 2008-12-31 11:15:49Z sebastian $ */ /* {{{ includes */ diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index a1732aa45..f99c16f8e 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: internal_functions_win32.c,v 1.87.2.1.2.3.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: internal_functions_win32.c 272370 2008-12-31 11:15:49Z sebastian $ */ /* {{{ includes */ diff --git a/main/logos.h b/main/logos.h index 645ef84dd..3c1d55bfc 100644 --- a/main/logos.h +++ b/main/logos.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: logos.h,v 1.14.2.3.2.2.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: logos.h 272370 2008-12-31 11:15:49Z sebastian $ */ #define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif" diff --git a/main/main.c b/main/main.c index 33d174e21..acd0f4c52 100644 --- a/main/main.c +++ b/main/main.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.640.2.23.2.57.2.55 2009/06/04 07:41:01 pajoye Exp $ */ +/* $Id: main.c 290034 2009-10-28 15:19:32Z pajoye $ */ /* {{{ includes */ @@ -349,8 +349,27 @@ static PHP_INI_DISP(display_errors_mode) static PHP_INI_MH(OnUpdateErrorLog) { /* Only do the safemode/open_basedir check at runtime */ - if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && - strcmp(new_value, "syslog")) { + if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value, "syslog")) { + if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + return FAILURE; + } + + if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) { + return FAILURE; + } + + } + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateMailLog) +{ + /* Only do the safemode/open_basedir check at runtime */ + if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { return FAILURE; } @@ -487,7 +506,7 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL) PHP_INI_ENTRY("smtp_port", "25", PHP_INI_ALL, NULL) STD_PHP_INI_BOOLEAN("mail.add_x_header", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, mail_x_header, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("mail.log", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, mail_log, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("mail.log", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateMailLog, mail_log, php_core_globals, core_globals) PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL) PHP_INI_ENTRY("memory_limit", "128M", PHP_INI_ALL, OnChangeMemoryLimit) PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision) @@ -496,6 +515,7 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("mail.force_extra_parameters",NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnChangeMailForceExtra) PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL) PHP_INI_ENTRY("disable_classes", "", PHP_INI_SYSTEM, NULL) + PHP_INI_ENTRY("max_file_uploads", "20", PHP_INI_SYSTEM, NULL) STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) @@ -516,6 +536,20 @@ static int module_initialized = 0; static int module_startup = 1; static int module_shutdown = 0; +/* {{{ php_during_module_startup */ +static int php_during_module_startup(void) +{ + return module_startup; +} +/* }}} */ + +/* {{{ php_during_module_shutdown */ +static int php_during_module_shutdown(void) +{ + return module_shutdown; +} +/* }}} */ + /* {{{ php_log_err */ PHPAPI void php_log_err(char *log_message TSRMLS_DC) @@ -523,11 +557,18 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) int fd = -1; time_t error_time; + if (PG(in_error_log)) { + /* prevent recursive invocation */ + return; + } + PG(in_error_log) = 1; + /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { #ifdef HAVE_SYSLOG_H if (!strcmp(PG(error_log), "syslog")) { php_syslog(LOG_NOTICE, "%.500s", log_message); + PG(in_error_log) = 0; return; } #endif @@ -547,6 +588,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) efree(tmp); efree(error_time_str); close(fd); + PG(in_error_log) = 0; return; } } @@ -556,6 +598,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) if (sapi_module.log_message) { sapi_module.log_message(log_message); } + PG(in_error_log) = 0; } /* }}} */ @@ -587,24 +630,6 @@ PHPAPI int php_printf(const char *format, ...) } /* }}} */ -/* {{{ php_verror helpers */ - -/* {{{ php_during_module_startup */ -static int php_during_module_startup(void) -{ - return module_startup; -} -/* }}} */ - -/* {{{ php_during_module_shutdown */ -static int php_during_module_shutdown(void) -{ - return module_shutdown; -} -/* }}} */ - -/* }}} */ - /* {{{ php_verror */ /* php_verror is called from php_error_docref<n> functions. * Its purpose is to unify error messages and automatically generate clickable @@ -1337,6 +1362,7 @@ int php_request_startup(TSRMLS_D) #endif zend_try { + PG(in_error_log) = 0; PG(during_request_startup) = 1; php_output_activate(TSRMLS_C); @@ -1991,10 +2017,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod php_ini_register_extensions(TSRMLS_C); zend_startup_modules(TSRMLS_C); - /* disable certain classes and functions as requested by php.ini */ - php_disable_functions(TSRMLS_C); - php_disable_classes(TSRMLS_C); - /* start Zend extensions */ zend_startup_extensions(); @@ -2007,12 +2029,17 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod } } + /* disable certain classes and functions as requested by php.ini */ + php_disable_functions(TSRMLS_C); + php_disable_classes(TSRMLS_C); + /* make core report what it should */ if (zend_hash_find(&module_registry, "core", sizeof("core"), (void**)&module)==SUCCESS) { module->version = PHP_VERSION; module->info_func = PHP_MINFO(php_core); } + #ifdef PHP_WIN32 /* Disable incompatible functions for the running platform */ if (php_win32_disable_functions() == FAILURE) { @@ -2136,7 +2163,9 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) char realfile[MAXPATHLEN]; #ifdef PHP_WIN32 - UpdateIniFromRegistry(primary_file->filename TSRMLS_CC); + if(primary_file->filename) { + UpdateIniFromRegistry(primary_file->filename TSRMLS_CC); + } #endif PG(during_request_startup) = 0; @@ -2226,7 +2255,9 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret zend_try { #ifdef PHP_WIN32 - UpdateIniFromRegistry(primary_file->filename TSRMLS_CC); + if(primary_file->filename) { + UpdateIniFromRegistry(primary_file->filename TSRMLS_CC); + } #endif PG(during_request_startup) = 0; diff --git a/main/mergesort.c b/main/mergesort.c index 6c7e559d5..fb62625d6 100644 --- a/main/mergesort.c +++ b/main/mergesort.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -/* $Id: mergesort.c,v 1.15.6.1 2008/08/22 12:59:46 helly Exp $ */ +/* $Id: mergesort.c 265279 2008-08-22 12:59:46Z helly $ */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94"; diff --git a/main/network.c b/main/network.c index 012493287..0d2f777cd 100644 --- a/main/network.c +++ b/main/network.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.118.2.2.2.6.2.17 2009/05/04 14:44:46 tony2001 Exp $ */ +/* $Id: network.c 289498 2009-10-10 12:21:08Z pajoye $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -314,7 +314,7 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd, SET_SOCKET_BLOCKING_MODE(sockfd, orig_flags); - if ((n = connect(sockfd, addr, addrlen)) < 0) { + if ((n = connect(sockfd, addr, addrlen)) != 0) { error = php_socket_errno(); if (error_code) { @@ -348,7 +348,7 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd, BSD-derived systems set errno correctly Solaris returns -1 from getsockopt in case of error */ - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) < 0) { + if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) != 0) { ret = -1; } } else { @@ -375,7 +375,7 @@ ok: if (asynchronous) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Asynchronous connect() not supported on this platform"); } - return connect(sockfd, addr, addrlen); + return (connect(sockfd, addr, addrlen) == 0) ? 0 : -1; #endif } /* }}} */ @@ -715,7 +715,7 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, clisock = accept(srvsock, (struct sockaddr*)&sa, &sl); - if (clisock >= 0) { + if (clisock != SOCK_ERR) { php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, textaddrlen, addr, addrlen @@ -792,7 +792,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short switch (sa->sa_family) { #if HAVE_GETADDRINFO && HAVE_IPV6 case AF_INET6: - if (bindto && strchr(bindto, ':')) { + if (!bindto || strchr(bindto, ':')) { ((struct sockaddr_in6 *)sa)->sin6_family = sa->sa_family; ((struct sockaddr_in6 *)sa)->sin6_port = htons(port); socklen = sizeof(struct sockaddr_in6); @@ -867,7 +867,7 @@ skip_bind: timeout ? &working_timeout : NULL, error_string, error_code); - if (n != SOCK_CONN_ERR) { + if (n != -1) { goto connected; } diff --git a/main/output.c b/main/output.c index 0c44cdf39..4c9c65438 100644 --- a/main/output.c +++ b/main/output.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.167.2.3.2.4.2.13 2009/03/25 23:59:45 cseiler Exp $ */ +/* $Id: output.c 289444 2009-10-09 19:13:33Z pajoye $ */ #include "php.h" #include "ext/standard/head.h" @@ -227,8 +227,6 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS ALLOC_INIT_ZVAL(orig_buffer); ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1); - Z_SET_REFCOUNT_P(orig_buffer, 2); /* don't let call_user_function() destroy our buffer */ - Z_SET_ISREF_P(orig_buffer); ALLOC_INIT_ZVAL(z_status); ZVAL_LONG(z_status, status); @@ -248,11 +246,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS if (!just_flush) { zval_ptr_dtor(&OG(active_ob_buffer).output_handler); } - Z_SET_REFCOUNT_P(orig_buffer, Z_REFCOUNT_P(orig_buffer) - 2); - if (Z_REFCOUNT_P(orig_buffer) <= 0) { /* free the zval */ - zval_dtor(orig_buffer); - FREE_ZVAL(orig_buffer); - } + zval_ptr_dtor(&orig_buffer); zval_ptr_dtor(&z_status); } diff --git a/main/php.h b/main/php.h index 58f414240..6655f3cb3 100644 --- a/main/php.h +++ b/main/php.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.221.2.4.2.8.2.13 2009/06/26 15:44:19 johannes Exp $ */ +/* $Id: php.h 282827 2009-06-26 15:44:19Z johannes $ */ #ifndef PHP_H #define PHP_H diff --git a/main/php3_compat.h b/main/php3_compat.h index 62549593b..8b994b9f9 100644 --- a/main/php3_compat.h +++ b/main/php3_compat.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php3_compat.h,v 1.20.2.1.2.1.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php3_compat.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP3_COMPAT_H #define PHP3_COMPAT_H diff --git a/main/php_compat.h b/main/php_compat.h index 5bd7eb5c4..3c6f5928b 100644 --- a/main/php_compat.h +++ b/main/php_compat.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_compat.h,v 1.25.2.3.2.4.2.4 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_compat.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_COMPAT_H #define PHP_COMPAT_H diff --git a/main/php_config.h.in b/main/php_config.h.in index 277ac23e0..e75aad767 100644 --- a/main/php_config.h.in +++ b/main/php_config.h.in @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: acconfig.h,v 1.40.2.1.2.1.2.3 2008/12/31 11:15:31 sebastian Exp $ */ +/* $Id: acconfig.h 272370 2008-12-31 11:15:49Z sebastian $ */ #if defined(__GNUC__) && __GNUC__ >= 4 # define ZEND_API __attribute__ ((visibility("default"))) @@ -434,9 +434,6 @@ /* Define if you have the realpath function. */ #undef HAVE_REALPATH -/* Define if you have the res_search function. */ -#undef HAVE_RES_SEARCH - /* Define if you have the rl_completion_matches function. */ #undef HAVE_RL_COMPLETION_MATCHES @@ -623,6 +620,9 @@ /* Define if you have the <arpa/nameser.h> header file. */ #undef HAVE_ARPA_NAMESER_H +/* Define if you have the <arpa/nameser_compat.h> header file. */ +#undef HAVE_ARPA_NAMESER_COMPAT_H + /* Define if you have the <assert.h> header file. */ #undef HAVE_ASSERT_H @@ -638,6 +638,9 @@ /* Define if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H +/* Define if you have the <dns.h> header file. */ +#undef HAVE_DNS_H + /* Define if you have the <errno.h> header file. */ #undef HAVE_ERRNO_H @@ -662,9 +665,6 @@ /* Define if you have the <locale.h> header file. */ #undef HAVE_LOCALE_H -/* Define if you have the <mach-o/dyld.h> header file. */ -#undef HAVE_MACH_O_DYLD_H - /* Define if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H @@ -830,9 +830,6 @@ /* Define if you have the m library (-lm). */ #undef HAVE_LIBM -/* Enabling BIND8 compatibility for Panther */ -#undef BIND_8_COMPAT - /* Define if the target system has /dev/urandom device */ #undef HAVE_DEV_URANDOM @@ -1059,6 +1056,15 @@ #undef HAVE_LIBBIND /* */ +#undef HAVE_NANOSLEEP + +/* */ +#undef HAVE_NANOSLEEP + +/* */ +#undef HAVE_LIBRT + +/* */ #undef HAVE_FOPENCOOKIE /* */ @@ -1424,6 +1430,12 @@ /* */ #undef HAVE_ENCHANT +/* */ +#undef HAVE_ENCHANT_BROKER_SET_PARAM + +/* */ +#undef ENCHANT_VERSION_STRING + /* Whether you want EXIF (metadata from images) support */ #undef HAVE_EXIF @@ -2463,64 +2475,43 @@ #undef ENABLE_CHROOT_FUNC /* */ -#undef HAVE_RES_NMKQUERY - -/* */ -#undef HAVE_RES_NMKQUERY - -/* */ -#undef HAVE_LIBRESOLV - -/* */ -#undef HAVE_RES_NMKQUERY - -/* */ -#undef HAVE_LIBBIND - -/* */ -#undef HAVE_RES_NMKQUERY +#undef HAVE_RES_NSEARCH /* */ -#undef HAVE_LIBSOCKET - -/* */ -#undef HAVE_RES_NSEND - -/* */ -#undef HAVE_RES_NSEND +#undef HAVE_RES_NSEARCH /* */ #undef HAVE_LIBRESOLV /* */ -#undef HAVE_RES_NSEND +#undef HAVE_RES_NSEARCH /* */ #undef HAVE_LIBBIND /* */ -#undef HAVE_RES_NSEND +#undef HAVE_RES_NSEARCH /* */ #undef HAVE_LIBSOCKET /* */ -#undef HAVE_RES_SEARCH +#undef HAVE_DNS_SEARCH /* */ -#undef HAVE_RES_SEARCH +#undef HAVE_DNS_SEARCH /* */ #undef HAVE_LIBRESOLV /* */ -#undef HAVE_RES_SEARCH +#undef HAVE_DNS_SEARCH /* */ #undef HAVE_LIBBIND /* */ -#undef HAVE_RES_SEARCH +#undef HAVE_DNS_SEARCH /* */ #undef HAVE_LIBSOCKET @@ -2568,43 +2559,22 @@ #undef HAVE_LIBSOCKET /* */ -#undef HAVE_RES_MKQUERY - -/* */ -#undef HAVE_RES_MKQUERY - -/* */ -#undef HAVE_LIBRESOLV - -/* */ -#undef HAVE_RES_MKQUERY - -/* */ -#undef HAVE_LIBBIND - -/* */ -#undef HAVE_RES_MKQUERY - -/* */ -#undef HAVE_LIBSOCKET - -/* */ -#undef HAVE_RES_SEND +#undef HAVE_RES_SEARCH /* */ -#undef HAVE_RES_SEND +#undef HAVE_RES_SEARCH /* */ #undef HAVE_LIBRESOLV /* */ -#undef HAVE_RES_SEND +#undef HAVE_RES_SEARCH /* */ #undef HAVE_LIBBIND /* */ -#undef HAVE_RES_SEND +#undef HAVE_RES_SEARCH /* */ #undef HAVE_LIBSOCKET diff --git a/main/php_content_types.c b/main/php_content_types.c index 2a55f48f1..85bdd69fb 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_content_types.c,v 1.32.2.1.2.4.2.3 2009/04/28 21:30:23 stas Exp $ */ +/* $Id: php_content_types.c 279522 2009-04-28 21:30:23Z stas $ */ #include "php.h" #include "SAPI.h" diff --git a/main/php_content_types.h b/main/php_content_types.h index 63a641c72..9d1c91065 100644 --- a/main/php_content_types.h +++ b/main/php_content_types.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_content_types.h,v 1.12.2.1.2.1.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_content_types.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_CONTENT_TYPES_H #define PHP_CONTENT_TYPES_H diff --git a/main/php_getopt.h b/main/php_getopt.h index 024ea5c05..e21d11815 100644 --- a/main/php_getopt.h +++ b/main/php_getopt.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_getopt.h,v 1.1.2.4 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_getopt.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_GETOPT_H #define PHP_GETOPT_H diff --git a/main/php_globals.h b/main/php_globals.h index 4af4b3ab0..5a8942bce 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_globals.h,v 1.98.2.1.2.7.2.7 2009/01/09 14:59:30 iliaa Exp $ */ +/* $Id: php_globals.h 289442 2009-10-09 19:06:10Z pajoye $ */ #ifndef PHP_GLOBALS_H #define PHP_GLOBALS_H @@ -168,6 +168,8 @@ struct _php_core_globals { zend_bool mail_x_header; char *mail_log; + + zend_bool in_error_log; }; diff --git a/main/php_ini.c b/main/php_ini.c index c021d6575..f1918f4a0 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ini.c,v 1.136.2.4.2.15.2.14 2009/05/18 21:33:38 derick Exp $ */ +/* $Id: php_ini.c 289668 2009-10-15 13:28:55Z pajoye $ */ #include "php.h" #include "ext/standard/info.h" @@ -41,6 +41,21 @@ #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif +#ifdef PHP_WIN32 +#define TRANSLATE_SLASHES_LOWER(path) \ + { \ + char *tmp = path; \ + while (*tmp) { \ + if (*tmp == '\\') *tmp = '/'; \ + else *tmp = tolower(*tmp); \ + tmp++; \ + } \ + } +#else +#define TRANSLATE_SLASHES_LOWER(path) +#endif + + typedef struct _php_extension_lists { zend_llist engine; zend_llist functions; @@ -274,6 +289,9 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t is_special_section = 1; has_per_dir_config = 1; + /* make the path lowercase on Windows, for case insensitivty. Does nothign for other platforms */ + TRANSLATE_SLASHES_LOWER(key); + /* HOST sections */ } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); @@ -281,6 +299,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; + zend_str_tolower(key, key_len); /* host names are case-insensitive. */ } else { is_special_section = 0; @@ -488,33 +507,18 @@ int php_init_config(TSRMLS_D) } strlcat(php_ini_search_path, default_location, search_path_size); } - efree(default_location); - { - /* For people running under terminal services, GetWindowsDirectory will - * return their personal Windows directory, so lets add the system - * windows directory too */ - typedef UINT (WINAPI *get_system_windows_directory_func)(char *buffer, UINT size); - static get_system_windows_directory_func get_system_windows_directory = NULL; - HMODULE kern; - - if (get_system_windows_directory == NULL) { - kern = LoadLibrary("kernel32.dll"); - if (kern) { - get_system_windows_directory = (get_system_windows_directory_func)GetProcAddress(kern, "GetSystemWindowsDirectoryA"); - } - } - if (get_system_windows_directory != NULL) { - default_location = (char *) emalloc(MAXPATHLEN + 1); - if (0 < get_system_windows_directory(default_location, MAXPATHLEN)) { - if (*php_ini_search_path) { - strlcat(php_ini_search_path, paths_separator, search_path_size); - } - strlcat(php_ini_search_path, default_location, search_path_size); - } - efree(default_location); + /* For people running under terminal services, GetWindowsDirectory will + * return their personal Windows directory, so lets add the system + * windows directory too */ + if (0 < GetSystemWindowsDirectory(default_location, MAXPATHLEN)) { + if (*php_ini_search_path) { + strlcat(php_ini_search_path, paths_separator, search_path_size); } + strlcat(php_ini_search_path, default_location, search_path_size); } + efree(default_location); + #else default_location = PHP_CONFIG_FILE_PATH; if (*php_ini_search_path) { @@ -789,10 +793,18 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC) zval *tmp; char *ptr; +#if PHP_WIN32 + char path_bak[MAXPATHLEN]; + memcpy(path_bak, path, path_len); + path_bak[path_len] = 0; + TRANSLATE_SLASHES_LOWER(path_bak); + path = path_bak; +#endif + /* Walk through each directory in path and apply any found per-dir-system-configuration from configuration_hash */ if (has_per_dir_config && path && path_len) { ptr = path + 1; - while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { + while ((ptr = strchr(ptr, '/')) != NULL) { *ptr = 0; /* Search for source array matching the path from configuration_hash */ if (zend_hash_find(&configuration_hash, path, path_len, (void **) &tmp) == SUCCESS) { diff --git a/main/php_ini.h b/main/php_ini.h index a05247160..3d6cb5d1e 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ini.h,v 1.45.2.3.2.3.2.9 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_ini.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_INI_H #define PHP_INI_H diff --git a/main/php_logos.c b/main/php_logos.c index 5cfa9c3f2..ae6d69b45 100644 --- a/main/php_logos.c +++ b/main/php_logos.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_logos.c,v 1.19.2.1.2.5.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_logos.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" #include "logos.h" diff --git a/main/php_logos.h b/main/php_logos.h index 8bf484c6c..644ee1614 100644 --- a/main/php_logos.h +++ b/main/php_logos.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_logos.h,v 1.9.2.1.2.3.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_logos.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef _PHP_LOGOS_H diff --git a/main/php_main.h b/main/php_main.h index 618edabb2..2d27f920b 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_main.h,v 1.34.2.1.2.2.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_main.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_MAIN_H #define PHP_MAIN_H diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h index 8f212e9fd..6b17dcaf8 100644 --- a/main/php_memory_streams.h +++ b/main/php_memory_streams.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_memory_streams.h,v 1.13.2.1.2.3.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_memory_streams.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_MEMORY_STREAM_H #define PHP_MEMORY_STREAM_H diff --git a/main/php_network.h b/main/php_network.h index 322a58e7e..51a2071ae 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_network.h,v 1.56.2.1.2.1.2.5 2009/01/07 20:21:46 felipe Exp $ */ +/* $Id: php_network.h 273010 2009-01-07 20:21:46Z felipe $ */ #ifndef _PHP_NETWORK_H #define _PHP_NETWORK_H diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 5834549b1..28623381e 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_open_temporary_file.c,v 1.34.2.1.2.10.2.4 2009/06/24 20:08:54 iliaa Exp $ */ +/* $Id: php_open_temporary_file.c 283130 2009-06-30 12:20:35Z iliaa $ */ #include "php.h" @@ -199,8 +199,15 @@ PHPAPI const char* php_get_temporary_directory(void) /* On Unix use the (usual) TMPDIR environment variable. */ { char* s = getenv("TMPDIR"); - if (s) { - temporary_directory = strdup(s); + if (s && *s) { + int len = strlen(s); + + if (s[len - 1] == DEFAULT_SLASH) { + temporary_directory = zend_strndup(s, len - 1); + } else { + temporary_directory = zend_strndup(s, len); + } + return temporary_directory; } } diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h index 0ae00c59f..094ebd26b 100644 --- a/main/php_open_temporary_file.h +++ b/main/php_open_temporary_file.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_open_temporary_file.h,v 1.13.2.1.2.4.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_open_temporary_file.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_OPEN_TEMPORARY_FILE_H #define PHP_OPEN_TEMPORARY_FILE_H diff --git a/main/php_output.h b/main/php_output.h index a1fefe765..8ad9cf593 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_output.h,v 1.53.2.1.2.1.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_output.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_OUTPUT_H #define PHP_OUTPUT_H diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h index 6ed1adf63..d076a4e40 100644 --- a/main/php_reentrancy.h +++ b/main/php_reentrancy.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reentrancy.h,v 1.23.2.1.2.1.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_reentrancy.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_REENTRANCY_H #define PHP_REENTRANCY_H diff --git a/main/php_scandir.c b/main/php_scandir.c index 6e02b2b69..d142731fc 100644 --- a/main/php_scandir.c +++ b/main/php_scandir.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_scandir.c,v 1.12.2.1.2.5.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_scandir.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" #include "php_scandir.h" diff --git a/main/php_scandir.h b/main/php_scandir.h index 9e900abb1..cf74ddfee 100644 --- a/main/php_scandir.h +++ b/main/php_scandir.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_scandir.h,v 1.12.2.1.2.1.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_scandir.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_SCANDIR_H #define PHP_SCANDIR_H diff --git a/main/php_sprintf.c b/main/php_sprintf.c index 04f2b556c..d6890b673 100644 --- a/main/php_sprintf.c +++ b/main/php_sprintf.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sprintf.c,v 1.23.2.1.2.1.2.3 2009/05/14 08:21:54 dmitry Exp $ */ +/* $Id: php_sprintf.c 280501 2009-05-14 08:21:54Z dmitry $ */ #include <stdio.h> #include <stdarg.h> diff --git a/main/php_streams.h b/main/php_streams.h index 1ec46decc..28b9c19b8 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_streams.h,v 1.103.2.1.2.4.2.10 2009/04/19 17:10:34 lbarnaud Exp $ */ +/* $Id: php_streams.h 279002 2009-04-19 17:10:35Z lbarnaud $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H diff --git a/main/php_syslog.h b/main/php_syslog.h index bbf1e053b..71c65cacc 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_syslog.h,v 1.12.2.1.2.1.2.2 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_syslog.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_SYSLOG_H #define PHP_SYSLOG_H diff --git a/main/php_ticks.c b/main/php_ticks.c index 63b887110..1d544e43b 100644 --- a/main/php_ticks.c +++ b/main/php_ticks.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ticks.c,v 1.20.2.1.2.1.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_ticks.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" #include "php_ticks.h" diff --git a/main/php_ticks.h b/main/php_ticks.h index af7062c83..dc7ae672b 100644 --- a/main/php_ticks.h +++ b/main/php_ticks.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ticks.h,v 1.14.2.1.2.1.2.3 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_ticks.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_TICKS_H #define PHP_TICKS_H diff --git a/main/php_variables.c b/main/php_variables.c index b331354d1..83b6a94dd 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.104.2.10.2.11.2.9 2008/12/31 11:15:47 sebastian Exp $ */ +/* $Id: php_variables.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include <stdio.h> #include "php.h" diff --git a/main/php_variables.h b/main/php_variables.h index e1421eea6..0237a2e5e 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.h,v 1.22.2.3.2.2.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_variables.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef PHP_VARIABLES_H #define PHP_VARIABLES_H diff --git a/main/php_version.h b/main/php_version.h index b73190a26..7adb32efd 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 3 -#define PHP_RELEASE_VERSION 0 +#define PHP_RELEASE_VERSION 1 #define PHP_EXTRA_VERSION "" -#define PHP_VERSION "5.3.0" -#define PHP_VERSION_ID 50300 +#define PHP_VERSION "5.3.1" +#define PHP_VERSION_ID 50301 diff --git a/main/reentrancy.c b/main/reentrancy.c index 13e4f93ed..7d2410aa2 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: reentrancy.c,v 1.43.2.1.2.2.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: reentrancy.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include <sys/types.h> #include <string.h> diff --git a/main/rfc1867.c b/main/rfc1867.c index ca76a7f30..31b74c164 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.173.2.1.2.9.2.9 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: rfc1867.c 290025 2009-10-28 11:03:36Z pajoye $ */ /* * This product includes software developed by the Apache Group @@ -795,6 +795,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) zend_llist header; void *event_extra_data = NULL; int llen = 0; + char *max_uploads = INI_STR("max_file_uploads"); + int upload_cnt = 0; + + if (max_uploads && *max_uploads) { + upload_cnt = atoi(max_uploads); + } if (SG(request_info).content_length > SG(post_max_size)) { sapi_module.sapi_error(E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes", SG(request_info).content_length, SG(post_max_size)); @@ -973,6 +979,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* If file_uploads=off, skip the file part */ if (!PG(file_uploads)) { skip_upload = 1; + } else if (upload_cnt <= 0) { + skip_upload = 1; + sapi_module.sapi_error(E_WARNING, "Maximum number of allowable file uploads has been exceeded"); } /* Return with an error if the posted data is garbled */ @@ -1017,6 +1026,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) if (!skip_upload) { /* Handle file */ fd = php_open_temporary_fd_ex(PG(upload_tmp_dir), "php", &temp_filename, 1 TSRMLS_CC); + upload_cnt--; if (fd==-1) { sapi_module.sapi_error(E_WARNING, "File upload error - unable to create a temporary file"); cancel_upload = UPLOAD_ERROR_E; diff --git a/main/rfc1867.h b/main/rfc1867.h index 8a68526c2..7038fadc7 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.h,v 1.13.2.1.2.3.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: rfc1867.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef RFC1867_H #define RFC1867_H diff --git a/main/safe_mode.c b/main/safe_mode.c index b0903609e..f57626fdc 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.62.2.1.2.10.2.8 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: safe_mode.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" diff --git a/main/safe_mode.h b/main/safe_mode.h index 0eac08265..cd52b11e5 100644 --- a/main/safe_mode.h +++ b/main/safe_mode.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.h,v 1.13.2.1.2.2.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: safe_mode.h 272370 2008-12-31 11:15:49Z sebastian $ */ #ifndef SAFE_MODE_H #define SAFE_MODE_H diff --git a/main/snprintf.c b/main/snprintf.c index 1f2396b1d..0a3f5a46b 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: snprintf.c,v 1.37.2.4.2.14.2.8 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: snprintf.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" diff --git a/main/snprintf.h b/main/snprintf.h index 970a1e7f5..8b21c8a3e 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: snprintf.h,v 1.32.2.3.2.5.2.5 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: snprintf.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* diff --git a/main/spprintf.c b/main/spprintf.c index ddc023705..eb9e46915 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spprintf.c,v 1.25.2.2.2.10.2.6 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: spprintf.c 272370 2008-12-31 11:15:49Z sebastian $ */ /* This is the spprintf implementation. * It has emerged from apache snprintf. See original header: diff --git a/main/spprintf.h b/main/spprintf.h index 7c566bfab..7e5661480 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spprintf.h,v 1.11.2.1.2.1.2.3 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: spprintf.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* diff --git a/main/streams/cast.c b/main/streams/cast.c index ae5cb2988..f42494601 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cast.c,v 1.12.2.1.2.1.2.6 2009/04/20 08:28:44 pajoye Exp $ */ +/* $Id: cast.c 279036 2009-04-20 08:28:44Z pajoye $ */ #define _GNU_SOURCE #include "php.h" diff --git a/main/streams/filter.c b/main/streams/filter.c index 00f79b311..e08efe643 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filter.c,v 1.17.2.3.2.10.2.4 2009/01/08 17:01:58 lbarnaud Exp $ */ +/* $Id: filter.c 273087 2009-01-08 17:01:58Z lbarnaud $ */ #include "php.h" #include "php_globals.h" diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index 55a8f3816..955aa806f 100755 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: glob_wrapper.c,v 1.6.2.6 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: glob_wrapper.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" #include "php_streams_int.h" diff --git a/main/streams/memory.c b/main/streams/memory.c index 11cd2fee8..062524649 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: memory.c,v 1.8.2.6.2.17.2.4 2009/05/16 20:27:36 lbarnaud Exp $ */ +/* $Id: memory.c 289437 2009-10-09 17:45:03Z pajoye $ */ #define _GNU_SOURCE #include "php.h" @@ -563,7 +563,7 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; self->innerstream = php_stream_memory_create_rel(mode); - php_stream_auto_cleanup(self->innerstream); // do not warn if innerstream is GC'ed before stream + php_stream_auto_cleanup(self->innerstream); /* do not warn if innerstream is GC'ed before stream */ ((php_stream_memory_data*)self->innerstream->abstract)->owner_ptr = &self->innerstream; return stream; diff --git a/main/streams/mmap.c b/main/streams/mmap.c index 409962632..78d8a66ea 100644 --- a/main/streams/mmap.c +++ b/main/streams/mmap.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mmap.c,v 1.8.2.1.2.1.2.6 2009/05/17 14:58:10 lbarnaud Exp $ */ +/* $Id: mmap.c 280678 2009-05-17 14:58:10Z lbarnaud $ */ /* Memory Mapping interface for streams */ #include "php.h" diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h index 8326d2116..a45808b25 100644 --- a/main/streams/php_stream_context.h +++ b/main/streams/php_stream_context.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_context.h,v 1.11.2.1.2.1.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_stream_context.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* Stream context and status notification related definitions */ diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h index e6342ad1b..4f1477008 100644 --- a/main/streams/php_stream_filter_api.h +++ b/main/streams/php_stream_filter_api.h @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_filter_api.h,v 1.13.2.1.2.1.2.4 2009/01/08 17:01:58 lbarnaud Exp $ */ +/* $Id: php_stream_filter_api.h 273087 2009-01-08 17:01:58Z lbarnaud $ */ /* The filter API works on the principle of "Bucket-Brigades". This is * partially inspired by the Apache 2 method of doing things, although diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h index 819c8de9c..63b4cf076 100755 --- a/main/streams/php_stream_glob_wrapper.h +++ b/main/streams/php_stream_glob_wrapper.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_glob_wrapper.h,v 1.5.2.4 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_stream_glob_wrapper.h 272370 2008-12-31 11:15:49Z sebastian $ */ PHPAPI extern php_stream_wrapper php_glob_stream_wrapper; PHPAPI extern php_stream_ops php_glob_stream_ops; diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h index f383f4a27..a3a2dbf6c 100644 --- a/main/streams/php_stream_mmap.h +++ b/main/streams/php_stream_mmap.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_mmap.h,v 1.5.2.1.2.1.2.3 2009/05/17 14:58:10 lbarnaud Exp $ */ +/* $Id: php_stream_mmap.h 280678 2009-05-17 14:58:10Z lbarnaud $ */ /* Memory Mapping interface for streams. * The intention is to provide a uniform interface over the most common diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h index e5a221109..36031719b 100644 --- a/main/streams/php_stream_plain_wrapper.h +++ b/main/streams/php_stream_plain_wrapper.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_plain_wrapper.h,v 1.7.2.2.2.1.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_stream_plain_wrapper.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* definitions for the plain files wrapper */ diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index 8f3c4d7e2..ec32b1eb6 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_transport.h,v 1.10.2.1.2.4.2.3 2009/02/02 09:41:46 pajoye Exp $ */ +/* $Id: php_stream_transport.h 275024 2009-02-02 09:41:46Z pajoye $ */ #ifdef PHP_WIN32 #include "config.w32.h" #include <Ws2tcpip.h> diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h index b268b460a..625c22b21 100644 --- a/main/streams/php_stream_userspace.h +++ b/main/streams/php_stream_userspace.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_userspace.h,v 1.5.2.1.2.1.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_stream_userspace.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* for user-space streams */ diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h index 46792f489..b0a1f3327 100644 --- a/main/streams/php_streams_int.h +++ b/main/streams/php_streams_int.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_streams_int.h,v 1.7.2.2.2.2.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: php_streams_int.h 272370 2008-12-31 11:15:49Z sebastian $ */ #if ZEND_DEBUG diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index c7e46ff69..549d38292 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.23.2.14 2009/04/11 11:44:15 mkoppanen Exp $ */ +/* $Id: plain_wrapper.c 290578 2009-11-12 15:05:03Z johannes $ */ #include "php.h" #include "php_globals.h" @@ -988,6 +988,10 @@ static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, ch return NULL; } + if ((php_check_safe_mode_include_dir(path TSRMLS_CC)) == 0) { + return php_stream_fopen_rel(path, mode, opened_path, options); + } + if ((options & ENFORCE_SAFE_MODE) && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM))) return NULL; diff --git a/main/streams/streams.c b/main/streams/streams.c index d18974f02..c2b4e3f85 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.82.2.6.2.18.2.28 2009/05/17 14:58:10 lbarnaud Exp $ */ +/* $Id: streams.c 280678 2009-05-17 14:58:10Z lbarnaud $ */ #define _GNU_SOURCE #include "php.h" diff --git a/main/streams/transports.c b/main/streams/transports.c index dbe495d29..1ac6677d9 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: transports.c,v 1.16.2.1.2.4.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: transports.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" #include "php_streams_int.h" diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 3117f3333..74e2f9173 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: userspace.c,v 1.31.2.3.2.7.2.10 2009/05/08 11:35:12 bjori Exp $ */ +/* $Id: userspace.c 280151 2009-05-08 11:35:12Z bjori $ */ #include "php.h" #include "php_globals.h" diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index c83493ce6..214c0118b 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.33.2.2.2.6.2.10 2009/02/09 02:55:45 iliaa Exp $ */ +/* $Id: xp_socket.c 289416 2009-10-09 14:20:17Z pajoye $ */ #include "php.h" #include "ext/standard/file.h" @@ -181,6 +181,10 @@ static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC) if (close_handle) { +#ifdef PHP_WIN32 + if (sock->socket == -1) + sock->socket = SOCK_ERR; +#endif if (sock->socket != SOCK_ERR) { #ifdef PHP_WIN32 /* prevent more data from coming in */ @@ -226,10 +230,12 @@ static inline int sock_sendto(php_netstream_data_t *sock, char *buf, size_t bufl struct sockaddr *addr, socklen_t addrlen TSRMLS_DC) { + int ret; if (addr) { - return sendto(sock->socket, buf, buflen, flags, addr, addrlen); + ret = sendto(sock->socket, buf, buflen, flags, addr, addrlen); + return (ret == SOCK_CONN_ERR) ? -1 : ret; } - return send(sock->socket, buf, buflen, flags); + return ((ret = send(sock->socket, buf, buflen, flags)) == SOCK_CONN_ERR) ? -1 : ret; } static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, @@ -244,10 +250,12 @@ static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t bu if (want_addr) { ret = recvfrom(sock->socket, buf, buflen, flags, (struct sockaddr*)&sa, &sl); + ret = (ret == SOCK_CONN_ERR) ? -1 : ret; php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, textaddrlen, addr, addrlen TSRMLS_CC); } else { ret = recv(sock->socket, buf, buflen, flags); + ret = (ret == SOCK_CONN_ERR) ? -1 : ret; } return ret; @@ -312,7 +320,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void switch (xparam->op) { case STREAM_XPORT_OP_LISTEN: - xparam->outputs.returncode = listen(sock->socket, 5); + xparam->outputs.returncode = (listen(sock->socket, 5) == 0) ? 0: -1; return PHP_STREAM_OPTION_RETURN_OK; case STREAM_XPORT_OP_GET_NAME: diff --git a/main/strlcat.c b/main/strlcat.c index 17bb241a8..fe4ca4207 100644 --- a/main/strlcat.c +++ b/main/strlcat.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: strlcat.c,v 1.13.2.1.2.1.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: strlcat.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" diff --git a/main/strlcpy.c b/main/strlcpy.c index 92760975b..d3b474667 100644 --- a/main/strlcpy.c +++ b/main/strlcpy.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: strlcpy.c,v 1.13.2.1.2.1.2.2 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: strlcpy.c 272370 2008-12-31 11:15:49Z sebastian $ */ #include "php.h" diff --git a/main/win32_internal_function_disabled.h b/main/win32_internal_function_disabled.h index e87090106..6681064bd 100644 --- a/main/win32_internal_function_disabled.h +++ b/main/win32_internal_function_disabled.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: win32_internal_function_disabled.h,v 1.1.2.2 2009/01/16 13:52:13 pajoye Exp $ */ +/* $Id: win32_internal_function_disabled.h 273638 2009-01-16 13:52:13Z pajoye $ */ /* 5 means the min version is 5 (XP/2000), 6 (2k8/vista), etc. */ diff --git a/main/win95nt.h b/main/win95nt.h index 61e34deb6..789294554 100644 --- a/main/win95nt.h +++ b/main/win95nt.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: win95nt.h,v 1.20.2.2.2.2.2.4 2008/12/31 11:15:48 sebastian Exp $ */ +/* $Id: win95nt.h 272370 2008-12-31 11:15:49Z sebastian $ */ /* Defines and types for Windows 95/NT */ #define HAVE_DECLARED_TIMEZONE |
