- Get rid of using ENFORCE_SAFE_MODE.

This commit is contained in:
Andi Gutmans 2006-02-19 04:29:42 +00:00
parent 8f126f33ac
commit 1efe984d08
34 changed files with 64 additions and 64 deletions

View file

@ -327,7 +327,7 @@ PHP_FUNCTION(bzopen)
stream = php_stream_bz2open(NULL, stream = php_stream_bz2open(NULL,
Z_STRVAL_PP(file), Z_STRVAL_PP(file),
Z_STRVAL_PP(mode), Z_STRVAL_PP(mode),
ENFORCE_SAFE_MODE | REPORT_ERRORS, REPORT_ERRORS,
NULL); NULL);
} else { } else {
/* If it is a resource, than its a stream resource */ /* If it is a resource, than its a stream resource */

View file

@ -753,7 +753,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* when in read only mode try to use existing .lck file first */ /* when in read only mode try to use existing .lck file first */
/* do not log errors for .lck file while in read ony mode on .lck file */ /* do not log errors for .lck file while in read ony mode on .lck file */
lock_file_mode = "rb"; lock_file_mode = "rb";
info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, &opened_path); info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|persistent_flag, &opened_path);
} }
if (!info->lock.fp) { if (!info->lock.fp) {
/* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */ /* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */
@ -768,7 +768,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} }
} }
if (!info->lock.fp) { if (!info->lock.fp) {
info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, &opened_path); info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|persistent_flag, &opened_path);
if (info->lock.fp) { if (info->lock.fp) {
if (lock_dbf) { if (lock_dbf) {
/* replace the path info with the real path of the opened file */ /* replace the path info with the real path of the opened file */
@ -806,7 +806,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (info->lock.fp && lock_dbf) { if (info->lock.fp && lock_dbf) {
info->fp = info->lock.fp; /* use the same stream for locking and database access */ info->fp = info->lock.fp; /* use the same stream for locking and database access */
} else { } else {
info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL); info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|persistent_flag, NULL);
} }
if (!info->fp) { if (!info->fp) {
dba_close(info TSRMLS_CC); dba_close(info TSRMLS_CC);

View file

@ -3729,7 +3729,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
ImageInfo->motorola_intel = -1; /* flag as unknown */ ImageInfo->motorola_intel = -1; /* flag as unknown */
ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH, NULL);
if (!ImageInfo->infile) { if (!ImageInfo->infile) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file"); exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file");
return FALSE; return FALSE;
@ -4047,7 +4047,7 @@ PHP_FUNCTION(exif_imagetype)
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
convert_to_string_ex(arg1); convert_to_string_ex(arg1);
stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|REPORT_ERRORS, NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;

View file

@ -684,9 +684,9 @@ PHP_FUNCTION(ftp_get)
#endif #endif
if (ftp->autoseek && resumepos) { if (ftp->autoseek && resumepos) {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", REPORT_ERRORS, NULL);
if (outstream == NULL) { if (outstream == NULL) {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL);
} }
if (outstream != NULL) { if (outstream != NULL) {
/* if autoresume is wanted seek to end */ /* if autoresume is wanted seek to end */
@ -698,7 +698,7 @@ PHP_FUNCTION(ftp_get)
} }
} }
} else { } else {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL);
} }
if (outstream == NULL) { if (outstream == NULL) {
@ -745,9 +745,9 @@ PHP_FUNCTION(ftp_nb_get)
mode = FTPTYPE_IMAGE; mode = FTPTYPE_IMAGE;
#endif #endif
if (ftp->autoseek && resumepos) { if (ftp->autoseek && resumepos) {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", REPORT_ERRORS, NULL);
if (outstream == NULL) { if (outstream == NULL) {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL);
} }
if (outstream != NULL) { if (outstream != NULL) {
/* if autoresume is wanted seek to end */ /* if autoresume is wanted seek to end */
@ -759,7 +759,7 @@ PHP_FUNCTION(ftp_nb_get)
} }
} }
} else { } else {
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL);
} }
if (outstream == NULL) { if (outstream == NULL) {
@ -941,7 +941,7 @@ PHP_FUNCTION(ftp_put)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode); XTYPE(xtype, mode);
if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) { if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", REPORT_ERRORS, NULL))) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -994,7 +994,7 @@ PHP_FUNCTION(ftp_nb_put)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode); XTYPE(xtype, mode);
if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) { if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", REPORT_ERRORS, NULL))) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -607,7 +607,7 @@ PHP_FUNCTION(imageloadfont)
convert_to_string_ex(file); convert_to_string_ex(file);
stream = php_stream_open_wrapper(Z_STRVAL_PP(file), "rb", ENFORCE_SAFE_MODE | IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(file), "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1400,7 +1400,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
fn = Z_STRVAL_PP(file); fn = Z_STRVAL_PP(file);
stream = php_stream_open_wrapper(fn, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); stream = php_stream_open_wrapper(fn, "rb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -82,7 +82,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
RETURN_FALSE; RETURN_FALSE;
} }
if (isfilename) { if (isfilename) {
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, DEFAULT_CONTEXT); stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
if (!stream) { if (!stream) {
/* Stream will report errors opening file */ /* Stream will report errors opening file */
RETURN_FALSE; RETURN_FALSE;
@ -157,7 +157,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
RETURN_FALSE; RETURN_FALSE;
} }
if (isfilename) { if (isfilename) {
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, DEFAULT_CONTEXT); stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
if (!stream) { if (!stream) {
/* Stream will report errors opening file */ /* Stream will report errors opening file */
RETURN_FALSE; RETURN_FALSE;
@ -388,7 +388,7 @@ PHP_FUNCTION(hash_update_file)
ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash); ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
context = php_stream_context_from_zval(zcontext, 0); context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, context); stream = php_stream_open_wrapper_ex(filename, "rb", REPORT_ERRORS, NULL, context);
if (!stream) { if (!stream) {
/* Stream will report errors opening file */ /* Stream will report errors opening file */
RETURN_FALSE; RETURN_FALSE;

View file

@ -136,7 +136,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
return; return;
} }
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -131,7 +131,7 @@ PHP_FUNCTION(sha1_file)
return; return;
} }
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -1886,7 +1886,7 @@ PHP_FUNCTION(imap_savebody)
default: default:
convert_to_string_ex(&out); convert_to_string_ex(&out);
writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS, NULL);
break; break;
} }

View file

@ -283,7 +283,7 @@ void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode,
that the streams layer puts out at times, but for libxml we that the streams layer puts out at times, but for libxml we
may try to open files that don't exist, but it is not a failure may try to open files that don't exist, but it is not a failure
in xml processing (eg. DTD files) */ in xml processing (eg. DTD files) */
wrapper = php_stream_locate_url_wrapper(resolved_path, &path_to_open, ENFORCE_SAFE_MODE TSRMLS_CC); wrapper = php_stream_locate_url_wrapper(resolved_path, &path_to_open, 0 TSRMLS_CC);
if (wrapper && read_only && wrapper->wops->url_stat) { if (wrapper && read_only && wrapper->wops->url_stat) {
if (wrapper->wops->url_stat(wrapper, path_to_open, PHP_STREAM_URL_STAT_QUIET, &ssbuf, NULL TSRMLS_CC) == -1) { if (wrapper->wops->url_stat(wrapper, path_to_open, PHP_STREAM_URL_STAT_QUIET, &ssbuf, NULL TSRMLS_CC) == -1) {
if (isescaped) { if (isescaped) {
@ -297,7 +297,7 @@ void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode,
context = zend_fetch_resource(&LIBXML(stream_context) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context()); context = zend_fetch_resource(&LIBXML(stream_context) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
} }
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL, context); ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
if (isescaped) { if (isescaped) {
xmlFree(resolved_path); xmlFree(resolved_path);
} }

View file

@ -1060,7 +1060,7 @@ static int magic_process(zval *what TSRMLS_DC)
switch (Z_TYPE_P(what)) { switch (Z_TYPE_P(what)) {
case IS_STRING: case IS_STRING:
stream = php_stream_open_wrapper(Z_STRVAL_P(what), "rb", IGNORE_PATH | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(Z_STRVAL_P(what), "rb", IGNORE_PATH | REPORT_ERRORS, NULL);
if (stream == NULL) { if (stream == NULL) {
/* We can't open it, but we were able to stat it. */ /* We can't open it, but we were able to stat it. */
if(MIME_MAGIC_G(debug)) if(MIME_MAGIC_G(debug))

View file

@ -1422,7 +1422,7 @@ PHP_METHOD(swffont, __construct)
php_stream * stream; php_stream * stream;
FILE * file; FILE * file;
stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), "rb", REPORT_ERRORS, NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
@ -2387,7 +2387,7 @@ PHP_METHOD(swfmovie, save)
} }
convert_to_string_ex(x); convert_to_string_ex(x);
stream = php_stream_open_wrapper(Z_STRVAL_PP(x), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(x), "wb", REPORT_ERRORS, NULL);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;

View file

@ -913,7 +913,7 @@ PHP_FUNCTION(oci_lob_export)
RETURN_FALSE; RETURN_FALSE;
} }
stream = php_stream_open_wrapper_ex(filename, "w", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL); stream = php_stream_open_wrapper_ex(filename, "w", REPORT_ERRORS, NULL, NULL);
block_length = PHP_OCI_LOB_BUFFER_SIZE; block_length = PHP_OCI_LOB_BUFFER_SIZE;
if (block_length > length) { if (block_length > length) {

View file

@ -183,7 +183,7 @@ static char *dsn_from_uri(char *uri, char *buf, size_t buflen TSRMLS_DC)
php_stream *stream; php_stream *stream;
char *dsn = NULL; char *dsn = NULL;
stream = php_stream_open_wrapper(uri, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(uri, "rb", REPORT_ERRORS, NULL);
if (stream) { if (stream) {
dsn = php_stream_get_line(stream, buf, buflen, NULL); dsn = php_stream_get_line(stream, buf, buflen, NULL);
php_stream_close(stream); php_stream_close(stream);

View file

@ -2354,7 +2354,7 @@ PHP_FUNCTION(pg_trace)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
convert_to_string_ex(z_filename); convert_to_string_ex(z_filename);
stream = php_stream_open_wrapper(Z_STRVAL_PP(z_filename), mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(z_filename), mode, REPORT_ERRORS, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;

View file

@ -147,7 +147,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, in
namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port); namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port);
stream = php_stream_xport_create(name, namelen, stream = php_stream_xport_create(name, namelen,
ENFORCE_SAFE_MODE | REPORT_ERRORS, REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
NULL /*persistent_id*/, NULL /*persistent_id*/,
timeout, timeout,

View file

@ -176,7 +176,7 @@ int php_stream_xmlIO_match_wrapper(const char *filename)
void *php_stream_xmlIO_open_wrapper(const char *filename) void *php_stream_xmlIO_open_wrapper(const char *filename)
{ {
TSRMLS_FETCH(); TSRMLS_FETCH();
return php_stream_open_wrapper((char*)filename, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL); return php_stream_open_wrapper((char*)filename, "rb", REPORT_ERRORS, NULL);
} }
int php_stream_xmlIO_read(void *context, char *buffer, int len) int php_stream_xmlIO_read(void *context, char *buffer, int len)

View file

@ -174,7 +174,7 @@ static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path TS
{ {
intern->type = SPL_FS_DIR; intern->type = SPL_FS_DIR;
intern->path_len = strlen(path); intern->path_len = strlen(path);
intern->u.dir.dirp = php_stream_opendir(path, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL); intern->u.dir.dirp = php_stream_opendir(path, REPORT_ERRORS, NULL);
if (intern->path_len && (path[intern->path_len-1] == '/' if (intern->path_len && (path[intern->path_len-1] == '/'
#if defined(PHP_WIN32) || defined(NETWARE) #if defined(PHP_WIN32) || defined(NETWARE)
@ -202,7 +202,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
{ {
intern->type = SPL_FS_FILE; intern->type = SPL_FS_FILE;
intern->u.file.context = php_stream_context_from_zval(intern->u.file.zcontext, 0); intern->u.file.context = php_stream_context_from_zval(intern->u.file.zcontext, 0);
intern->u.file.stream = php_stream_open_wrapper_ex(intern->file_name, intern->u.file.open_mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, intern->u.file.context); intern->u.file.stream = php_stream_open_wrapper_ex(intern->file_name, intern->u.file.open_mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, intern->u.file.context);
if (intern->u.file.stream == NULL) { if (intern->u.file.stream == NULL) {
if (!EG(exception)) { if (!EG(exception)) {

View file

@ -2033,7 +2033,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T
break; break;
case 3: /*save to a file */ case 3: /*save to a file */
stream = php_stream_open_wrapper(opt, "a", IGNORE_URL | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); stream = php_stream_open_wrapper(opt, "a", IGNORE_URL | REPORT_ERRORS, NULL);
if (!stream) if (!stream)
return FAILURE; return FAILURE;
php_stream_write(stream, message, strlen(message)); php_stream_write(stream, message, strlen(message));

View file

@ -192,7 +192,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
context = php_stream_context_from_zval(zcontext, 0); context = php_stream_context_from_zval(zcontext, 0);
} }
dirp = php_stream_opendir(dirname, ENFORCE_SAFE_MODE|REPORT_ERRORS, context); dirp = php_stream_opendir(dirname, REPORT_ERRORS, context);
if (dirp == NULL) { if (dirp == NULL) {
RETURN_FALSE; RETURN_FALSE;

View file

@ -379,7 +379,7 @@ PHP_FUNCTION(get_meta_tags)
} }
md.stream = php_stream_open_wrapper(filename, "rb", md.stream = php_stream_open_wrapper(filename, "rb",
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS,
NULL); NULL);
if (!md.stream) { if (!md.stream) {
@ -531,7 +531,7 @@ PHP_FUNCTION(file_get_contents)
context = php_stream_context_from_zval(zcontext, 0); context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb", stream = php_stream_open_wrapper_ex(filename, "rb",
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS,
NULL, context); NULL, context);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
@ -592,7 +592,7 @@ PHP_FUNCTION(file_put_contents)
mode[1] = 't'; mode[1] = 't';
} }
stream = php_stream_open_wrapper_ex(filename, mode, stream = php_stream_open_wrapper_ex(filename, mode,
((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | REPORT_ERRORS, NULL, context);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -751,7 +751,7 @@ PHP_FUNCTION(file)
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -893,7 +893,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
context = php_stream_context_from_zval(zcontext, 0); context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context);
if (stream == NULL) { if (stream == NULL) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1491,7 +1491,7 @@ PHP_FUNCTION(readfile)
context = php_stream_context_from_zval(zcontext, 0); context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); stream = php_stream_open_wrapper_ex(filename, "rb", (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context);
if (stream) { if (stream) {
size = php_stream_passthru(stream); size = php_stream_passthru(stream);
php_stream_close(stream); php_stream_close(stream);
@ -1612,7 +1612,7 @@ PHP_FUNCTION(unlink)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s does not allow unlinking", wrapper->wops->label ? wrapper->wops->label : "Wrapper"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s does not allow unlinking", wrapper->wops->label ? wrapper->wops->label : "Wrapper");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, ENFORCE_SAFE_MODE | REPORT_ERRORS, context TSRMLS_CC)); RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, REPORT_ERRORS, context TSRMLS_CC));
} }
/* }}} */ /* }}} */
@ -1817,7 +1817,7 @@ safe_to_copy:
return ret; return ret;
} }
deststream = php_stream_open_wrapper(dest, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); deststream = php_stream_open_wrapper(dest, "wb", REPORT_ERRORS, NULL);
if (srcstream && deststream) { if (srcstream && deststream) {
ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS; ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS;

View file

@ -76,7 +76,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ZVAL_STRING(zerrstr, "", 1); ZVAL_STRING(zerrstr, "", 1);
} }
stream = php_stream_xport_create(hostname, hostname_len, ENFORCE_SAFE_MODE | REPORT_ERRORS, stream = php_stream_xport_create(hostname, hostname_len, REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err); STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err);
if (port > 0) { if (port > 0) {

View file

@ -123,7 +123,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
Z_TYPE_PP(tmpzval) != IS_STRING || Z_TYPE_PP(tmpzval) != IS_STRING ||
Z_STRLEN_PP(tmpzval) <= 0) { Z_STRLEN_PP(tmpzval) <= 0) {
php_url_free(resource); php_url_free(resource);
return php_stream_open_wrapper_ex(path, mode, ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context);
} }
/* Called from a non-http wrapper with http proxying requested (i.e. ftp) */ /* Called from a non-http wrapper with http proxying requested (i.e. ftp) */
request_fulluri = 1; request_fulluri = 1;

View file

@ -1291,7 +1291,7 @@ PHP_FUNCTION(getimagesize)
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;

View file

@ -85,7 +85,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
return; return;
} }
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -660,7 +660,7 @@ PHP_FUNCTION(proc_open)
/* try a wrapper */ /* try a wrapper */
stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), Z_STRVAL_PP(zmode), stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), Z_STRVAL_PP(zmode),
ENFORCE_SAFE_MODE|REPORT_ERRORS|STREAM_WILL_CAST, NULL); REPORT_ERRORS|STREAM_WILL_CAST, NULL);
/* force into an fd */ /* force into an fd */
if (stream == NULL || FAILURE == php_stream_cast(stream, if (stream == NULL || FAILURE == php_stream_cast(stream,

View file

@ -85,7 +85,7 @@ PHP_FUNCTION(sha1_file)
return; return;
} }
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -116,7 +116,7 @@ PHP_FUNCTION(stream_socket_client)
ZVAL_STRING(zerrstr, "", 1); ZVAL_STRING(zerrstr, "", 1);
} }
stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS, stream = php_stream_xport_create(host, host_len, REPORT_ERRORS,
STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) | STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) |
(flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0), (flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0),
hashkey, &tv, context, &errstr, &err); hashkey, &tv, context, &errstr, &err);
@ -190,7 +190,7 @@ PHP_FUNCTION(stream_socket_server)
ZVAL_STRING(zerrstr, "", 1); ZVAL_STRING(zerrstr, "", 1);
} }
stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS, stream = php_stream_xport_create(host, host_len, REPORT_ERRORS,
STREAM_XPORT_SERVER | flags, STREAM_XPORT_SERVER | flags,
NULL, NULL, context, &errstr, &err); NULL, NULL, context, &errstr, &err);

View file

@ -514,7 +514,7 @@ static char *php_tidy_file_to_mem(char *filename, zend_bool use_include_path, in
php_stream *stream; php_stream *stream;
char *data = NULL; char *data = NULL;
if (!(stream = php_stream_open_wrapper(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE, NULL))) { if (!(stream = php_stream_open_wrapper(filename, "rb", (use_include_path ? USE_PATH : 0), NULL))) {
return NULL; return NULL;
} }
if ((*len = (int) php_stream_copy_to_mem(stream, &data, PHP_STREAM_COPY_ALL, 0)) == 0) { if ((*len = (int) php_stream_copy_to_mem(stream, &data, PHP_STREAM_COPY_ALL, 0)) == 0) {

View file

@ -300,7 +300,7 @@ static void *php_xmlwriter_streams_IO_open_write_wrapper(const char *filename TS
php_stream_wrapper *wrapper = NULL; php_stream_wrapper *wrapper = NULL;
void *ret_val = NULL; void *ret_val = NULL;
ret_val = php_stream_open_wrapper_ex((char *)filename, "wb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL, NULL); ret_val = php_stream_open_wrapper_ex((char *)filename, "wb", REPORT_ERRORS, NULL, NULL);
return ret_val; return ret_val;
} }
/* }}} */ /* }}} */

View file

@ -294,7 +294,7 @@ PHP_FUNCTION(gzfile)
use_include_path = flags ? USE_PATH : 0; use_include_path = flags ? USE_PATH : 0;
/* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */ /* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */
stream = php_stream_gzopen(NULL, filename, "rb", use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); stream = php_stream_gzopen(NULL, filename, "rb", use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC);
if (stream == NULL) { if (stream == NULL) {
/* Error reporting is already done by stream code */ /* Error reporting is already done by stream code */
RETURN_FALSE; RETURN_FALSE;
@ -336,7 +336,7 @@ PHP_FUNCTION(gzopen)
use_include_path = flags ? USE_PATH : 0; use_include_path = flags ? USE_PATH : 0;
stream = php_stream_gzopen(NULL, filename, mode, use_include_path | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC); stream = php_stream_gzopen(NULL, filename, mode, use_include_path | REPORT_ERRORS, NULL, NULL STREAMS_CC TSRMLS_CC);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
@ -365,7 +365,7 @@ PHP_FUNCTION(readgzfile)
use_include_path = flags ? USE_PATH : 0; use_include_path = flags ? USE_PATH : 0;
stream = php_stream_gzopen(NULL, filename, "rb", use_include_path | ENFORCE_SAFE_MODE, NULL, NULL STREAMS_CC TSRMLS_CC); stream = php_stream_gzopen(NULL, filename, "rb", use_include_path, NULL, NULL STREAMS_CC TSRMLS_CC);
if (!stream) { if (!stream) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -1001,7 +1001,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
{ {
TSRMLS_FETCH(); TSRMLS_FETCH();
return php_stream_open_wrapper_as_file((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path); return php_stream_open_wrapper_as_file((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path);
} }
/* }}} */ /* }}} */
@ -1019,7 +1019,7 @@ static int php_stream_open_for_zend(const char *filename, zend_file_handle *hand
{ {
php_stream *stream; php_stream *stream;
stream = php_stream_open_wrapper((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, &handle->opened_path); stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, &handle->opened_path);
if (stream) { if (stream) {
handle->type = ZEND_HANDLE_STREAM; handle->type = ZEND_HANDLE_STREAM;

View file

@ -1005,7 +1005,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p
reslen = spprintf(&res, 0, "tcp://%s:%d", host, port); reslen = spprintf(&res, 0, "tcp://%s:%d", host, port);
stream = php_stream_xport_create(res, reslen, ENFORCE_SAFE_MODE | REPORT_ERRORS, stream = php_stream_xport_create(res, reslen, REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, persistent_id, timeout, NULL, NULL, NULL); STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, persistent_id, timeout, NULL, NULL, NULL);
efree(res); efree(res);

View file

@ -2222,7 +2222,7 @@ PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_conte
{ {
php_stream_wrapper *wrapper = NULL; php_stream_wrapper *wrapper = NULL;
wrapper = php_stream_locate_url_wrapper(path, NULL, ENFORCE_SAFE_MODE TSRMLS_CC); wrapper = php_stream_locate_url_wrapper(path, NULL, 0 TSRMLS_CC);
if (!wrapper || !wrapper->wops || !wrapper->wops->stream_mkdir) { if (!wrapper || !wrapper->wops || !wrapper->wops->stream_mkdir) {
return 0; return 0;
} }
@ -2237,7 +2237,7 @@ PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *contex
{ {
php_stream_wrapper *wrapper = NULL; php_stream_wrapper *wrapper = NULL;
wrapper = php_stream_locate_url_wrapper(path, NULL, ENFORCE_SAFE_MODE TSRMLS_CC); wrapper = php_stream_locate_url_wrapper(path, NULL, 0 TSRMLS_CC);
if (!wrapper || !wrapper->wops || !wrapper->wops->stream_rmdir) { if (!wrapper || !wrapper->wops || !wrapper->wops->stream_rmdir) {
return 0; return 0;
} }
@ -2266,7 +2266,7 @@ PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb,
} }
} }
wrapper = php_stream_locate_url_wrapper(path, &path_to_open, ENFORCE_SAFE_MODE TSRMLS_CC); wrapper = php_stream_locate_url_wrapper(path, &path_to_open, 0 TSRMLS_CC);
if (wrapper && wrapper->wops->url_stat) { if (wrapper && wrapper->wops->url_stat) {
ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC);
if (ret == 0) { if (ret == 0) {
@ -2692,7 +2692,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_
return FAILURE; return FAILURE;
} }
stream = php_stream_opendir(dirname, ENFORCE_SAFE_MODE | REPORT_ERRORS, context); stream = php_stream_opendir(dirname, REPORT_ERRORS, context);
if (!stream) { if (!stream) {
return FAILURE; return FAILURE;
} }