components/php/php56/patches/CVE-2015-4025_CVE-2015-4026.patch
changeset 4408 47b0133297d6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/php/php56/patches/CVE-2015-4025_CVE-2015-4026.patch	Thu Jun 04 09:10:36 2015 -0700
@@ -0,0 +1,659 @@
+# Source: upstream
+# http://git.php.net/?p=php-src.git;a=patch;h=bbe4b87e1d1fa858c208368a28c0fb17c7774fe0;hp=676e0c0f7b294f8948f77a213d22ce9cdd014e4f
+# Fixed in 5.6.9
+# This patch also contains unnecessary whitespace changes but is left as is
+
+From bbe4b87e1d1fa858c208368a28c0fb17c7774fe0 Mon Sep 17 00:00:00 2001
+From: Stanislav Malyshev <[email protected]>
+Date: Sat, 9 May 2015 23:13:06 -0700
+Subject: [PATCH 1/1] Fixed bug #69418 - more s->p fixes for filenames
+
+Conflicts:
+	ext/pcntl/pcntl.c
+	ext/standard/basic_functions.c
+---
+ ext/pcntl/pcntl.c              | 74 +++++++++++++++++++++---------------------
+ ext/standard/basic_functions.c | 29 ++++++++++-------
+ ext/standard/dir.c             | 62 +++++++++++++++++------------------
+ ext/standard/file.c            |  4 +--
+ 4 files changed, 88 insertions(+), 81 deletions(-)
+
+diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
+index bace3b0..09520a9 100644
+--- a/ext/pcntl/pcntl.c
++++ b/ext/pcntl/pcntl.c
+@@ -198,7 +198,7 @@ ZEND_GET_MODULE(pcntl)
+ 
+ static void pcntl_signal_handler(int);
+ static void pcntl_signal_dispatch();
+-  
++
+ void php_register_signal_constants(INIT_FUNC_ARGS)
+ {
+ 
+@@ -234,7 +234,7 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
+ 	REGISTER_LONG_CONSTANT("SIGTERM",  (long) SIGTERM, CONST_CS | CONST_PERSISTENT);
+ #ifdef SIGSTKFLT
+ 	REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
+-#endif 
++#endif
+ #ifdef SIGCLD
+ 	REGISTER_LONG_CONSTANT("SIGCLD",   (long) SIGCLD, CONST_CS | CONST_PERSISTENT);
+ #endif
+@@ -484,7 +484,7 @@ static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
+ }
+ 
+ static PHP_GINIT_FUNCTION(pcntl)
+-{ 
++{
+ 	memset(pcntl_globals, 0, sizeof(*pcntl_globals));
+ }
+ 
+@@ -547,7 +547,7 @@ PHP_FUNCTION(pcntl_fork)
+ 		PCNTL_G(last_error) = errno;
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
+ 	}
+-	
++
+ 	RETURN_LONG((long) id);
+ }
+ /* }}} */
+@@ -560,7 +560,7 @@ PHP_FUNCTION(pcntl_alarm)
+ 
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
+ 		return;
+-	
++
+ 	RETURN_LONG ((long) alarm(seconds));
+ }
+ /* }}} */
+@@ -576,7 +576,7 @@ PHP_FUNCTION(pcntl_waitpid)
+ 
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE)
+ 		return;
+-	
++
+ 	convert_to_long_ex(&z_status);
+ 
+ 	status = Z_LVAL_P(z_status);
+@@ -604,7 +604,7 @@ PHP_FUNCTION(pcntl_wait)
+ 
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &z_status, &options) == FAILURE)
+ 		return;
+-	
++
+ 	convert_to_long_ex(&z_status);
+ 
+ 	status = Z_LVAL_P(z_status);
+@@ -628,7 +628,7 @@ PHP_FUNCTION(pcntl_wait)
+ }
+ /* }}} */
+ 
+-/* {{{ proto bool pcntl_wifexited(int status) 
++/* {{{ proto bool pcntl_wifexited(int status)
+    Returns true if the child status code represents a successful exit */
+ PHP_FUNCTION(pcntl_wifexited)
+ {
+@@ -646,7 +646,7 @@ PHP_FUNCTION(pcntl_wifexited)
+ }
+ /* }}} */
+ 
+-/* {{{ proto bool pcntl_wifstopped(int status) 
++/* {{{ proto bool pcntl_wifstopped(int status)
+    Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
+ PHP_FUNCTION(pcntl_wifstopped)
+ {
+@@ -664,7 +664,7 @@ PHP_FUNCTION(pcntl_wifstopped)
+ }
+ /* }}} */
+ 
+-/* {{{ proto bool pcntl_wifsignaled(int status) 
++/* {{{ proto bool pcntl_wifsignaled(int status)
+    Returns true if the child status code represents a process that was terminated due to a signal */
+ PHP_FUNCTION(pcntl_wifsignaled)
+ {
+@@ -682,7 +682,7 @@ PHP_FUNCTION(pcntl_wifsignaled)
+ }
+ /* }}} */
+ 
+-/* {{{ proto int pcntl_wexitstatus(int status) 
++/* {{{ proto int pcntl_wexitstatus(int status)
+    Returns the status code of a child's exit */
+ PHP_FUNCTION(pcntl_wexitstatus)
+ {
+@@ -700,7 +700,7 @@ PHP_FUNCTION(pcntl_wexitstatus)
+ }
+ /* }}} */
+ 
+-/* {{{ proto int pcntl_wtermsig(int status) 
++/* {{{ proto int pcntl_wtermsig(int status)
+    Returns the number of the signal that terminated the process who's status code is passed  */
+ PHP_FUNCTION(pcntl_wtermsig)
+ {
+@@ -718,7 +718,7 @@ PHP_FUNCTION(pcntl_wtermsig)
+ }
+ /* }}} */
+ 
+-/* {{{ proto int pcntl_wstopsig(int status) 
++/* {{{ proto int pcntl_wstopsig(int status)
+    Returns the number of the signal that caused the process to stop who's status code is passed */
+ PHP_FUNCTION(pcntl_wstopsig)
+ {
+@@ -754,19 +754,19 @@ PHP_FUNCTION(pcntl_exec)
+ 	char *path;
+ 	int path_len;
+ 	ulong key_num;
+-		
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
++
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|aa", &path, &path_len, &args, &envs) == FAILURE) {
+ 		return;
+ 	}
+-	
++
+ 	if (ZEND_NUM_ARGS() > 1) {
+ 		/* Build argument list */
+ 		args_hash = HASH_OF(args);
+ 		argc = zend_hash_num_elements(args_hash);
+-		
++
+ 		argv = safe_emalloc((argc + 2), sizeof(char *), 0);
+ 		*argv = path;
+-		for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; 
++		for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
+ 			(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
+ 			(argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
+ 
+@@ -784,9 +784,9 @@ PHP_FUNCTION(pcntl_exec)
+ 		/* Build environment pair list */
+ 		envs_hash = HASH_OF(envs);
+ 		envc = zend_hash_num_elements(envs_hash);
+-		
++
+ 		envp = safe_emalloc((envc + 1), sizeof(char *), 0);
+-		for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp; 
++		for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
+ 			(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
+ 			(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
+ 			switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
+@@ -802,13 +802,13 @@ PHP_FUNCTION(pcntl_exec)
+ 
+ 			convert_to_string_ex(element);
+ 
+-			/* Length of element + equal sign + length of key + null */ 
++			/* Length of element + equal sign + length of key + null */
+ 			pair_length = Z_STRLEN_PP(element) + key_length + 2;
+ 			*pair = emalloc(pair_length);
+-			strlcpy(*pair, key, key_length); 
++			strlcpy(*pair, key, key_length);
+ 			strlcat(*pair, "=", pair_length);
+ 			strlcat(*pair, Z_STRVAL_PP(element), pair_length);
+-			
++
+ 			/* Cleanup */
+ 			if (return_val == HASH_KEY_IS_LONG) efree(key);
+ 		}
+@@ -818,7 +818,7 @@ PHP_FUNCTION(pcntl_exec)
+ 			PCNTL_G(last_error) = errno;
+ 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
+ 		}
+-	
++
+ 		/* Cleanup */
+ 		for (pair = envp; *pair != NULL; pair++) efree(*pair);
+ 		efree(envp);
+@@ -831,7 +831,7 @@ PHP_FUNCTION(pcntl_exec)
+ 	}
+ 
+ 	efree(argv);
+-	
++
+ 	RETURN_FALSE;
+ }
+ /* }}} */
+@@ -881,7 +881,7 @@ PHP_FUNCTION(pcntl_signal)
+ 		zend_hash_index_del(&PCNTL_G(php_signal_table), signo);
+ 		RETURN_TRUE;
+ 	}
+-	
++
+ 	if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) {
+ 		PCNTL_G(last_error) = EINVAL;
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name);
+@@ -889,11 +889,11 @@ PHP_FUNCTION(pcntl_signal)
+ 		RETURN_FALSE;
+ 	}
+ 	efree(func_name);
+-	
++
+ 	/* Add the function name to our signal table */
+ 	zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle);
+ 	if (dest_handle) zval_add_ref(dest_handle);
+-	
++
+ 	if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == SIG_ERR) {
+ 		PCNTL_G(last_error) = errno;
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
+@@ -1030,7 +1030,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
+ 	}
+ 
+ 	/*
+-	 * sigtimedwait and sigwaitinfo can return 0 on success on some 
++	 * sigtimedwait and sigwaitinfo can return 0 on success on some
+ 	 * platforms, e.g. NetBSD
+ 	 */
+ 	if (!signo && siginfo.si_signo) {
+@@ -1078,7 +1078,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
+ 			EMPTY_SWITCH_DEFAULT_CASE();
+ 		}
+ 	}
+-	
++
+ 	RETURN_LONG(signo);
+ }
+ /* }}} */
+@@ -1108,12 +1108,12 @@ PHP_FUNCTION(pcntl_getpriority)
+ 	long who = PRIO_PROCESS;
+ 	long pid = getpid();
+ 	int pri;
+-	
++
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) {
+ 		RETURN_FALSE;
+ 	}
+ 
+-	/* needs to be cleared, since any returned value is valid */ 
++	/* needs to be cleared, since any returned value is valid */
+ 	errno = 0;
+ 
+ 	pri = getpriority(who, pid);
+@@ -1173,7 +1173,7 @@ PHP_FUNCTION(pcntl_setpriority)
+ 		}
+ 		RETURN_FALSE;
+ 	}
+-	
++
+ 	RETURN_TRUE;
+ }
+ /* }}} */
+@@ -1206,7 +1206,7 @@ static void pcntl_signal_handler(int signo)
+ {
+ 	struct php_pcntl_pending_signal *psig;
+ 	TSRMLS_FETCH();
+-	
++
+ 	psig = PCNTL_G(spares);
+ 	if (!psig) {
+ 		/* oops, too many signals for us to track, so we'll forget about this one */
+@@ -1239,7 +1239,7 @@ void pcntl_signal_dispatch()
+ 	if(!PCNTL_G(pending_signals)) {
+ 		return;
+ 	}
+-		
++	
+ 	/* Mask all signals */
+ 	sigfillset(&mask);
+ 	sigprocmask(SIG_BLOCK, &mask, &old_mask);
+@@ -1255,7 +1255,7 @@ void pcntl_signal_dispatch()
+ 
+ 	queue = PCNTL_G(head);
+ 	PCNTL_G(head) = NULL; /* simple stores are atomic */
+-	
++
+ 	/* Allocate */
+ 
+ 	while (queue) {
+@@ -1282,7 +1282,7 @@ void pcntl_signal_dispatch()
+ 
+ 	/* Re-enable queue */
+ 	PCNTL_G(processing_signal_queue) = 0;
+-	
++
+ 	/* return signal mask to previous state */
+ 	sigprocmask(SIG_SETMASK, &old_mask, NULL);
+ }
+diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
+index a3783e0..83d140e 100644
+--- a/ext/standard/basic_functions.c
++++ b/ext/standard/basic_functions.c
+@@ -2127,7 +2127,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0)
+ 	ZEND_ARG_INFO(0, fp)
+ 	ZEND_ARG_INFO(0, buffer)
+ ZEND_END_ARG_INFO()
+-		
++
+ ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0)
+ 	ZEND_ARG_INFO(0, fp)
+ 	ZEND_ARG_INFO(0, chunk_size)
+@@ -2322,7 +2322,7 @@ ZEND_END_ARG_INFO()
+ ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0)
+ 	ZEND_ARG_INFO(0, str)
+ ZEND_END_ARG_INFO()
+-	
++
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1)
+ 	ZEND_ARG_INFO(0, str)
+ 	ZEND_ARG_INFO(0, delimiters)
+@@ -3475,7 +3475,7 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) /*
+ 	BG(user_tick_functions) = NULL;
+ 	BG(user_filter_map) = NULL;
+ 	BG(serialize_lock) = 0;
+-	
++
+ 	memset(&BG(serialize), 0, sizeof(BG(serialize)));
+ 	memset(&BG(unserialize), 0, sizeof(BG(unserialize)));
+ 
+@@ -4034,8 +4034,8 @@ PHP_FUNCTION(getenv)
+ 		int size;
+ 
+ 		SetLastError(0);
+-		/*If the given bugger is not large enough to hold the data, the return value is 
+-		the buffer size,  in characters, required to hold the string and its terminating 
++		/*If the given bugger is not large enough to hold the data, the return value is
++		the buffer size,  in characters, required to hold the string and its terminating
+ 		null character. We use this return value to alloc the final buffer. */
+ 		size = GetEnvironmentVariableA(str, &dummybuf, 0);
+ 		if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
+@@ -4087,7 +4087,7 @@ PHP_FUNCTION(putenv)
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &setting, &setting_len) == FAILURE) {
+ 		return;
+ 	}
+-    
++
+     if(setting_len == 0 || setting[0] == '=') {
+     	php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax");
+     	RETURN_FALSE;
+@@ -4151,6 +4151,13 @@ PHP_FUNCTION(putenv)
+ 	&& _putenv(pe.putenv_string) == 0
+ # endif
+ 	) { /* success */
++#  if _MSC_VER < 1500
++	/* Yet another VC6 bug, unset may return env not found */
++	if (error_code != 0 ||
++		(error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
++#  else
++	if (error_code != 0) { /* success */
++#  endif
+ # endif
+ #endif
+ 		zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL);
+@@ -4634,7 +4641,7 @@ PHP_FUNCTION(set_magic_quotes_runtime)
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
+ 		return;
+ 	}
+-	
++
+ 	if (new_setting) {
+ 		php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
+ 	}
+@@ -4922,7 +4929,7 @@ PHP_FUNCTION(forward_static_call)
+ 		instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
+ 			fci_cache.called_scope = EG(called_scope);
+ 	}
+-	
++
+ 	if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) {
+ 		COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr);
+ 	}
+@@ -5495,7 +5502,7 @@ PHP_FUNCTION(set_include_path)
+ 	int new_value_len;
+ 	char *old_value;
+ 
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) {
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &new_value, &new_value_len) == FAILURE) {
+ 		return;
+ 	}
+ 
+@@ -5623,7 +5630,7 @@ PHP_FUNCTION(getservbyname)
+ 	}
+ 
+ 
+-/* empty string behaves like NULL on windows implementation of 
++/* empty string behaves like NULL on windows implementation of
+    getservbyname. Let be portable instead. */
+ #ifdef PHP_WIN32
+ 	if (proto_len == 0) {
+@@ -6051,7 +6058,7 @@ PHP_FUNCTION(parse_ini_string)
+ /* }}} */
+ 
+ #if ZEND_DEBUG
+-/* This function returns an array of ALL valid ini options with values and 
++/* This function returns an array of ALL valid ini options with values and
+  *  is not the same as ini_get_all() which returns only registered ini options. Only useful for devs to debug php.ini scanner/parser! */
+ PHP_FUNCTION(config_get_hash) /* {{{ */
+ {
+diff --git a/ext/standard/dir.c b/ext/standard/dir.c
+index 2ba4024..ddf884f 100644
+--- a/ext/standard/dir.c
++++ b/ext/standard/dir.c
+@@ -93,8 +93,8 @@ static zend_class_entry *dir_class_entry_ptr;
+ 		dirp = (php_stream *) zend_fetch_resource(&id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \
+ 		if (!dirp) \
+ 			RETURN_FALSE; \
+-	} 
+-	
++	}
++
+ /* {{{ arginfo */
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0)
+ 	ZEND_ARG_INFO(0, dir_handle)
+@@ -118,7 +118,7 @@ static void php_set_default_dir(int id TSRMLS_DC)
+ 	if (id != -1) {
+ 		zend_list_addref(id);
+ 	}
+-	
++
+ 	DIRG(default_dir) = id;
+ }
+ 
+@@ -168,25 +168,25 @@ PHP_MINIT_FUNCTION(dir)
+ 
+ #ifdef GLOB_NOSORT
+ 	REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT);
+-#else 
++#else
+ # define GLOB_NOSORT 0
+ #endif
+ 
+ #ifdef GLOB_NOCHECK
+ 	REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT);
+-#else 
++#else
+ # define GLOB_NOCHECK 0
+ #endif
+ 
+ #ifdef GLOB_NOESCAPE
+ 	REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT);
+-#else 
++#else
+ # define GLOB_NOESCAPE 0
+ #endif
+ 
+ #ifdef GLOB_ERR
+ 	REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT);
+-#else 
++#else
+ # define GLOB_ERR 0
+ #endif
+ 
+@@ -219,12 +219,12 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
+ 	php_stream_context *context = NULL;
+ 	php_stream *dirp;
+ 
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) {
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dirname, &dir_len, &zcontext) == FAILURE) {
+ 		RETURN_NULL();
+ 	}
+ 
+ 	context = php_stream_context_from_zval(zcontext, 0);
+-	
++
+ 	dirp = php_stream_opendir(dirname, REPORT_ERRORS, context);
+ 
+ 	if (dirp == NULL) {
+@@ -232,7 +232,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
+ 	}
+ 
+ 	dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
+-		
++
+ 	php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
+ 
+ 	if (createobject) {
+@@ -293,11 +293,11 @@ PHP_FUNCTION(chroot)
+ {
+ 	char *str;
+ 	int ret, str_len;
+-	
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
++
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) {
+ 		RETURN_FALSE;
+ 	}
+-	
++
+ 	ret = chroot(str);
+ 	if (ret != 0) {
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
+@@ -305,9 +305,9 @@ PHP_FUNCTION(chroot)
+ 	}
+ 
+ 	php_clear_stat_cache(1, NULL, 0 TSRMLS_CC);
+-	
++
+ 	ret = chdir("/");
+-	
++
+ 	if (ret != 0) {
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
+ 		RETURN_FALSE;
+@@ -324,7 +324,7 @@ PHP_FUNCTION(chdir)
+ {
+ 	char *str;
+ 	int ret, str_len;
+-	
++
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) {
+ 		RETURN_FALSE;
+ 	}
+@@ -333,7 +333,7 @@ PHP_FUNCTION(chdir)
+ 		RETURN_FALSE;
+ 	}
+ 	ret = VCWD_CHDIR(str);
+-	
++
+ 	if (ret != 0) {
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno);
+ 		RETURN_FALSE;
+@@ -358,7 +358,7 @@ PHP_FUNCTION(getcwd)
+ {
+ 	char path[MAXPATHLEN];
+ 	char *ret=NULL;
+-	
++
+ 	if (zend_parse_parameters_none() == FAILURE) {
+ 		return;
+ 	}
+@@ -383,7 +383,7 @@ PHP_FUNCTION(rewinddir)
+ {
+ 	zval *id = NULL, **tmp, *myself;
+ 	php_stream *dirp;
+-	
++
+ 	FETCH_DIRP();
+ 
+ 	if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
+@@ -450,9 +450,9 @@ PHP_FUNCTION(glob)
+ 		RETURN_FALSE;
+ 	}
+ 
+-#ifdef ZTS 
++#ifdef ZTS
+ 	if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) {
+-		result = VCWD_GETCWD(cwd, MAXPATHLEN);	
++		result = VCWD_GETCWD(cwd, MAXPATHLEN);
+ 		if (!result) {
+ 			cwd[0] = '\0';
+ 		}
+@@ -465,10 +465,10 @@ PHP_FUNCTION(glob)
+ 
+ 		snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
+ 		pattern = work_pattern;
+-	} 
++	}
+ #endif
+ 
+-	
++
+ 	memset(&globbuf, 0, sizeof(glob_t));
+ 	globbuf.gl_offs = 0;
+ 	if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) {
+@@ -477,7 +477,7 @@ PHP_FUNCTION(glob)
+ 			/* Some glob implementation simply return no data if no matches
+ 			   were found, others return the GLOB_NOMATCH error code.
+ 			   We don't want to treat GLOB_NOMATCH as an error condition
+-			   so that PHP glob() behaves the same on both types of 
++			   so that PHP glob() behaves the same on both types of
+ 			   implementations and so that 'foreach (glob() as ...'
+ 			   can be used for simple glob() calls without further error
+ 			   checking.
+@@ -517,11 +517,11 @@ no_results:
+ 		}
+ 		/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
+ 		 * all directories will be filtered. GNU libc documentation states the
+-		 * following: 
+-		 * If the information about the type of the file is easily available 
+-		 * non-directories will be rejected but no extra work will be done to 
+-		 * determine the information for each file. I.e., the caller must still be 
+-		 * able to filter directories out. 
++		 * following:
++		 * If the information about the type of the file is easily available
++		 * non-directories will be rejected but no extra work will be done to
++		 * determine the information for each file. I.e., the caller must still be
++		 * able to filter directories out.
+ 		 */
+ 		if (flags & GLOB_ONLYDIR) {
+ 			struct stat s;
+@@ -545,7 +545,7 @@ no_results:
+ 	}
+ }
+ /* }}} */
+-#endif 
++#endif
+ 
+ /* {{{ proto array scandir(string dir [, int sorting_order [, resource context]])
+    List files & directories inside the specified path */
+@@ -583,7 +583,7 @@ PHP_FUNCTION(scandir)
+ 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "(errno %d): %s", errno, strerror(errno));
+ 		RETURN_FALSE;
+ 	}
+-	
++
+ 	array_init(return_value);
+ 
+ 	for (i = 0; i < n; i++) {
+diff --git a/ext/standard/file.c b/ext/standard/file.c
+index c2e71d1..0abc022 100644
+--- a/ext/standard/file.c
++++ b/ext/standard/file.c
+@@ -814,7 +814,7 @@ PHP_FUNCTION(tempnam)
+ 	char *p;
+ 	int fd;
+ 
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) {
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) {
+ 		return;
+ 	}
+ 
+@@ -1343,7 +1343,7 @@ PHP_FUNCTION(rmdir)
+ 	zval *zcontext = NULL;
+ 	php_stream_context *context;
+ 
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dir, &dir_len, &zcontext) == FAILURE) {
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dir, &dir_len, &zcontext) == FAILURE) {
+ 		RETURN_FALSE;
+ 	}
+ 
+-- 
+2.1.4
+