summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2010-08-17 12:17:28 +0000
committerKalle Sommer Nielsen <kalle@php.net>2010-08-17 12:17:28 +0000
commita12f6d9312256a4e1dd4091099add8397fd01e12 (patch)
treea6009620dd5377c273f3ced5a16f24a21e9dfc97
parent0cbc4a08a161aa0290fc7bb1dcffbffda127b3b8 (diff)
downloadphp-git-a12f6d9312256a4e1dd4091099add8397fd01e12.tar.gz
Fixed the $context parameter on copy() to have an effect (approved for 5.3 by Johannes)
# To not change a PHPAPI in a point release, a new function have been added to support contexts: # php_copy_file_ctx(), php_copy_file_ex() now simply wraps to that
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/file.c20
-rw-r--r--ext/standard/file.h3
3 files changed, 18 insertions, 7 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index f7baa75c59..df6ca7e41a 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5716,7 +5716,7 @@ PHP_FUNCTION(move_uploaded_file)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
}
#endif
- } else if (php_copy_file_ex(path, new_path, STREAM_DISABLE_OPEN_BASEDIR, NULL TSRMLS_CC) == SUCCESS) {
+ } else if (php_copy_file_ex(path, new_path, STREAM_DISABLE_OPEN_BASEDIR TSRMLS_CC) == SUCCESS) {
VCWD_UNLINK(path);
successful = 1;
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index fe0c27854d..47b0c03fbd 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1646,7 +1646,7 @@ PHP_FUNCTION(copy)
context = php_stream_context_from_zval(zcontext, 0);
- if (php_copy_file_ex(source, target, 0, context TSRMLS_CC) == SUCCESS) {
+ if (php_copy_file_ctx(source, target, 0, context TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -1654,15 +1654,25 @@ PHP_FUNCTION(copy)
}
/* }}} */
-PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC) /* {{{ */
+/* {{{ php_copy_file
+ */
+PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
{
- return php_copy_file_ex(src, dest, 0, NULL TSRMLS_CC);
+ return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC);
}
/* }}} */
-/* {{{ php_copy_file
+/* {{{ php_copy_file_ex
+ */
+PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg TSRMLS_DC)
+{
+ return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ php_copy_file_ctx
*/
-PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC)
+PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC)
{
php_stream *srcstream = NULL, *deststream = NULL;
int ret = FAILURE;
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 37acc99508..eef483af96 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -75,7 +75,8 @@ PHP_MINIT_FUNCTION(user_streams);
PHPAPI int php_le_stream_context(void);
PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
-PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
+PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC);
+PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC);
PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC);
PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC);