summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c178
1 files changed, 89 insertions, 89 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 8fad2aa4f1..acb34b8968 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -44,14 +44,14 @@
# include "win32/time.h"
#endif
-#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC)
-#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC)
-#define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC TSRMLS_CC)
-#define php_stream_fopen_from_file_int_rel(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_REL_CC TSRMLS_CC)
+#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC)
+#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC)
+#define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC)
+#define php_stream_fopen_from_file_int_rel(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_REL_CC)
#if !defined(WINDOWS) && !defined(NETWARE)
-extern int php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC);
-extern int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC);
+extern int php_get_uid_by_name(const char *name, uid_t *uid);
+extern int php_get_gid_by_name(const char *name, gid_t *gid);
#endif
#if defined(PHP_WIN32)
@@ -158,7 +158,7 @@ static int do_fstat(php_stdio_stream_data *d, int force)
return 0;
}
-static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC)
+static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_id STREAMS_DC)
{
php_stdio_stream_data *self;
@@ -174,7 +174,7 @@ static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const
return php_stream_alloc_rel(&php_stream_stdio_ops, self, persistent_id, mode);
}
-static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode STREAMS_DC TSRMLS_DC)
+static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode STREAMS_DC)
{
php_stdio_stream_data *self;
@@ -190,12 +190,12 @@ static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode
return php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
}
-PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path_ptr STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path_ptr STREAMS_DC)
{
char *opened_path = NULL;
int fd;
- fd = php_open_temporary_fd(dir, pfx, &opened_path TSRMLS_CC);
+ fd = php_open_temporary_fd(dir, pfx, &opened_path);
if (fd != -1) {
php_stream *stream;
@@ -216,19 +216,19 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char
}
close(fd);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate stream");
+ php_error_docref(NULL, E_WARNING, "unable to allocate stream");
return NULL;
}
return NULL;
}
-PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC)
{
return php_stream_fopen_temporary_file(NULL, "php", NULL);
}
-PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC)
{
php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id);
@@ -267,7 +267,7 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha
return stream;
}
-PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC)
{
php_stream *stream = php_stream_fopen_from_file_int_rel(file, mode);
@@ -299,7 +299,7 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE
return stream;
}
-PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC)
{
php_stdio_stream_data *self;
php_stream *stream;
@@ -318,7 +318,7 @@ PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STRE
return stream;
}
-static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
+static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count)
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
@@ -345,7 +345,7 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count
}
}
-static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
+static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
size_t ret;
@@ -406,7 +406,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
return ret;
}
-static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
+static int php_stdiop_close(php_stream *stream, int close_handle)
{
int ret;
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
@@ -467,7 +467,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
return ret;
}
-static int php_stdiop_flush(php_stream *stream TSRMLS_DC)
+static int php_stdiop_flush(php_stream *stream)
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
@@ -484,7 +484,7 @@ static int php_stdiop_flush(php_stream *stream TSRMLS_DC)
return 0;
}
-static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC)
+static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset)
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
int ret;
@@ -492,7 +492,7 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze
assert(data != NULL);
if (data->is_pipe) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot seek on a pipe");
+ php_error_docref(NULL, E_WARNING, "cannot seek on a pipe");
return -1;
}
@@ -513,7 +513,7 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze
}
}
-static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
+static int php_stdiop_cast(php_stream *stream, int castas, void **ret)
{
php_socket_t fd;
php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
@@ -571,7 +571,7 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
}
}
-static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
+static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb)
{
int ret;
php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
@@ -583,7 +583,7 @@ static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC
return ret;
}
-static int php_stdiop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
+static int php_stdiop_set_option(php_stream *stream, int option, int value, void *ptrparam)
{
php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
size_t size;
@@ -846,7 +846,7 @@ PHPAPI php_stream_ops php_stream_stdio_ops = {
/* }}} */
/* {{{ plain files opendir/readdir implementation */
-static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
+static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count)
{
DIR *dir = (DIR*)stream->abstract;
/* avoid libc5 readdir problems */
@@ -865,12 +865,12 @@ static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size
return 0;
}
-static int php_plain_files_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC)
+static int php_plain_files_dirstream_close(php_stream *stream, int close_handle)
{
return closedir((DIR *)stream->abstract);
}
-static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
+static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs)
{
rewinddir((DIR *)stream->abstract);
return 0;
@@ -887,18 +887,18 @@ static php_stream_ops php_plain_files_dirstream_ops = {
};
static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const char *path, const char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
+ int options, char **opened_path, php_stream_context *context STREAMS_DC)
{
DIR *dir = NULL;
php_stream *stream = NULL;
#ifdef HAVE_GLOB
if (options & STREAM_USE_GLOB_DIR_OPEN) {
- return php_glob_stream_wrapper.wops->dir_opener(&php_glob_stream_wrapper, path, mode, options, opened_path, context STREAMS_REL_CC TSRMLS_CC);
+ return php_glob_stream_wrapper.wops->dir_opener(&php_glob_stream_wrapper, path, mode, options, opened_path, context STREAMS_REL_CC);
}
#endif
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) {
return NULL;
}
@@ -906,7 +906,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const
#ifdef PHP_WIN32
if (!dir) {
- php_win32_docref2_from_error(GetLastError(), path, path TSRMLS_CC);
+ php_win32_docref2_from_error(GetLastError(), path, path);
}
if (dir && dir->finished) {
@@ -925,7 +925,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const
/* }}} */
/* {{{ php_stream_fopen */
-PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC)
{
char *realpath = NULL;
int open_flags;
@@ -936,7 +936,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha
if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "`%s' is not a valid mode for fopen", mode);
+ php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode);
}
return NULL;
}
@@ -944,14 +944,14 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha
if (options & STREAM_ASSUME_REALPATH) {
realpath = estrdup(filename);
} else {
- if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) {
+ if ((realpath = expand_filepath(filename, NULL)) == NULL) {
return NULL;
}
}
if (persistent) {
spprintf(&persistent_id, 0, "streams_stdio_%d_%s", open_flags, realpath);
- switch (php_stream_from_persistent_id(persistent_id, &ret TSRMLS_CC)) {
+ switch (php_stream_from_persistent_id(persistent_id, &ret)) {
case PHP_STREAM_PERSISTENT_SUCCESS:
if (opened_path) {
*opened_path = realpath;
@@ -1025,22 +1025,22 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha
static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode,
- int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
+ int options, char **opened_path, php_stream_context *context STREAMS_DC)
{
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) {
return NULL;
}
return php_stream_fopen_rel(path, mode, opened_path, options);
}
-static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context)
{
if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) {
url += sizeof("file://") - 1;
}
- if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1 TSRMLS_CC)) {
+ if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1)) {
return -1;
}
@@ -1060,7 +1060,7 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *u
return VCWD_STAT(url, &ssb->sb);
}
-static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context)
{
int ret;
@@ -1068,25 +1068,25 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url,
url += sizeof("file://") - 1;
}
- if (php_check_open_basedir(url TSRMLS_CC)) {
+ if (php_check_open_basedir(url)) {
return 0;
}
ret = VCWD_UNLINK(url);
if (ret == -1) {
if (options & REPORT_ERRORS) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
+ php_error_docref1(NULL, url, E_WARNING, "%s", strerror(errno));
}
return 0;
}
/* Clear stat cache (and realpath cache) */
- php_clear_stat_cache(1, NULL, 0 TSRMLS_CC);
+ php_clear_stat_cache(1, NULL, 0);
return 1;
}
-static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context)
{
int ret;
@@ -1096,11 +1096,11 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
#ifdef PHP_WIN32
if (!php_win32_check_trailing_space(url_from, (int)strlen(url_from))) {
- php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC);
+ php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to);
return 0;
}
if (!php_win32_check_trailing_space(url_to, (int)strlen(url_to))) {
- php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC);
+ php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to);
return 0;
}
#endif
@@ -1113,7 +1113,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
url_to += sizeof("file://") - 1;
}
- if (php_check_open_basedir(url_from TSRMLS_CC) || php_check_open_basedir(url_to TSRMLS_CC)) {
+ if (php_check_open_basedir(url_from) || php_check_open_basedir(url_to)) {
return 0;
}
@@ -1124,25 +1124,25 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
# ifdef EXDEV
if (errno == EXDEV) {
zend_stat_t sb;
- if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) {
+ if (php_copy_file(url_from, url_to) == SUCCESS) {
if (VCWD_STAT(url_from, &sb) == 0) {
# if !defined(TSRM_WIN32) && !defined(NETWARE)
if (VCWD_CHMOD(url_to, sb.st_mode)) {
if (errno == EPERM) {
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
}
if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) {
if (errno == EPERM) {
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
}
# endif
@@ -1150,27 +1150,27 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
return 1;
}
}
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
}
# endif
#endif
#ifdef PHP_WIN32
- php_win32_docref2_from_error(GetLastError(), url_from, url_to TSRMLS_CC);
+ php_win32_docref2_from_error(GetLastError(), url_from, url_to);
#else
- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));
+ php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
#endif
return 0;
}
/* Clear stat cache (and realpath cache) */
- php_clear_stat_cache(1, NULL, 0 TSRMLS_CC);
+ php_clear_stat_cache(1, NULL, 0);
return 1;
}
-static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context)
{
int ret, recursive = options & PHP_STREAM_MKDIR_RECURSIVE;
char *p;
@@ -1180,7 +1180,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
}
if (!recursive) {
- ret = php_mkdir(dir, mode TSRMLS_CC);
+ ret = php_mkdir(dir, mode);
} else {
/* we look for directory separator from the end of string, thus hopefuly reducing our work load */
char *e;
@@ -1189,8 +1189,8 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
int offset = 0;
char buf[MAXPATHLEN];
- if (!expand_filepath_with_mode(dir, buf, NULL, 0, CWD_EXPAND TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
+ if (!expand_filepath_with_mode(dir, buf, NULL, 0, CWD_EXPAND )) {
+ php_error_docref(NULL, E_WARNING, "Invalid path");
return 0;
}
@@ -1227,8 +1227,8 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
}
if (p == buf) {
- ret = php_mkdir(dir, mode TSRMLS_CC);
- } else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) {
+ ret = php_mkdir(dir, mode);
+ } else if (!(ret = php_mkdir(buf, mode))) {
if (!p) {
p = buf;
}
@@ -1239,7 +1239,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
if ((*(p+1) != '\0') &&
(ret = VCWD_MKDIR(buf, (mode_t)mode)) < 0) {
if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
}
break;
}
@@ -1256,35 +1256,35 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
}
}
-static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context)
{
if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) {
url += sizeof("file://") - 1;
}
- if (php_check_open_basedir(url TSRMLS_CC)) {
+ if (php_check_open_basedir(url)) {
return 0;
}
#if PHP_WIN32
if (!php_win32_check_trailing_space(url, (int)strlen(url))) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(ENOENT));
+ php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT));
return 0;
}
#endif
if (VCWD_RMDIR(url) < 0) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
+ php_error_docref1(NULL, url, E_WARNING, "%s", strerror(errno));
return 0;
}
/* Clear stat cache (and realpath cache) */
- php_clear_stat_cache(1, NULL, 0 TSRMLS_CC);
+ php_clear_stat_cache(1, NULL, 0);
return 1;
}
-static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context)
{
struct utimbuf *newtime;
#if !defined(WINDOWS) && !defined(NETWARE)
@@ -1299,7 +1299,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
#if PHP_WIN32
if (!php_win32_check_trailing_space(url, url_len)) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(ENOENT));
+ php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT));
return 0;
}
#endif
@@ -1308,7 +1308,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
url += sizeof("file://") - 1;
}
- if (php_check_open_basedir(url TSRMLS_CC)) {
+ if (php_check_open_basedir(url)) {
return 0;
}
@@ -1318,7 +1318,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
if (VCWD_ACCESS(url, F_OK) != 0) {
FILE *file = VCWD_FOPEN(url, "w");
if (file == NULL) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to create file %s because %s", url, strerror(errno));
+ php_error_docref1(NULL, url, E_WARNING, "Unable to create file %s because %s", url, strerror(errno));
return 0;
}
fclose(file);
@@ -1330,8 +1330,8 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
case PHP_STREAM_META_OWNER_NAME:
case PHP_STREAM_META_OWNER:
if(option == PHP_STREAM_META_OWNER_NAME) {
- if(php_get_uid_by_name((char *)value, &uid TSRMLS_CC) != SUCCESS) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to find uid for %s", (char *)value);
+ if(php_get_uid_by_name((char *)value, &uid) != SUCCESS) {
+ php_error_docref1(NULL, url, E_WARNING, "Unable to find uid for %s", (char *)value);
return 0;
}
} else {
@@ -1342,8 +1342,8 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
case PHP_STREAM_META_GROUP:
case PHP_STREAM_META_GROUP_NAME:
if(option == PHP_STREAM_META_OWNER_NAME) {
- if(php_get_gid_by_name((char *)value, &gid TSRMLS_CC) != SUCCESS) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unable to find gid for %s", (char *)value);
+ if(php_get_gid_by_name((char *)value, &gid) != SUCCESS) {
+ php_error_docref1(NULL, url, E_WARNING, "Unable to find gid for %s", (char *)value);
return 0;
}
} else {
@@ -1357,14 +1357,14 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
ret = VCWD_CHMOD(url, mode);
break;
default:
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unknown option %d for stream_metadata", option);
+ php_error_docref1(NULL, url, E_WARNING, "Unknown option %d for stream_metadata", option);
return 0;
}
if (ret == -1) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Operation failed: %s", strerror(errno));
+ php_error_docref1(NULL, url, E_WARNING, "Operation failed: %s", strerror(errno));
return 0;
}
- php_clear_stat_cache(0, NULL, 0 TSRMLS_CC);
+ php_clear_stat_cache(0, NULL, 0);
return 1;
}
@@ -1390,7 +1390,7 @@ PHPAPI php_stream_wrapper php_plain_files_wrapper = {
};
/* {{{ php_stream_fopen_with_path */
-PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC)
+PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC)
{
/* code ripped off from fopen_wrappers.c */
char *pathbuf, *end;
@@ -1424,7 +1424,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char
}
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename)) {
return NULL;
}
@@ -1436,7 +1436,7 @@ not_relative_path:
/* Absolute path open */
if (IS_ABSOLUTE_PATH(filename, filename_length)) {
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename)) {
return NULL;
}
@@ -1447,17 +1447,17 @@ not_relative_path:
if (IS_SLASH(filename[0])) {
size_t cwd_len;
char *cwd;
- cwd = virtual_getcwd_ex(&cwd_len TSRMLS_CC);
+ cwd = virtual_getcwd_ex(&cwd_len);
/* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */
*(cwd+3) = '\0';
if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) >= MAXPATHLEN) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN);
+ php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN);
}
efree(cwd);
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath)) {
return NULL;
}
@@ -1473,8 +1473,8 @@ not_relative_path:
/* append the calling scripts' current working directory
* as a fall back case
*/
- if (zend_is_executing(TSRMLS_C)) {
- exec_fname = zend_get_executed_filename(TSRMLS_C);
+ if (zend_is_executing()) {
+ exec_fname = zend_get_executed_filename();
exec_fname_length = (int)strlen(exec_fname);
path_length = (int)strlen(path);
@@ -1506,10 +1506,10 @@ not_relative_path:
goto stream_skip;
}
if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN);
+ php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN);
}
- if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0 TSRMLS_CC)) {
+ if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0)) {
goto stream_skip;
}