From 1efe984d08ccab1d06f062ca157e3bdb2cb7cd57 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sun, 19 Feb 2006 04:29:42 +0000 Subject: [PATCH] - Get rid of using ENFORCE_SAFE_MODE. --- ext/bz2/bz2.c | 2 +- ext/dba/dba.c | 6 +++--- ext/exif/exif.c | 4 ++-- ext/ftp/php_ftp.c | 16 ++++++++-------- ext/gd/gd.c | 4 ++-- ext/hash/hash.c | 6 +++--- ext/hash/hash_md.c | 2 +- ext/hash/hash_sha.c | 2 +- ext/imap/php_imap.c | 2 +- ext/libxml/libxml.c | 4 ++-- ext/mime_magic/mime_magic.c | 2 +- ext/ming/ming.c | 4 ++-- ext/oci8/oci8_interface.c | 2 +- ext/pdo/pdo_dbh.c | 2 +- ext/pgsql/pgsql.c | 2 +- ext/soap/php_http.c | 2 +- ext/soap/php_xml.c | 2 +- ext/spl/spl_directory.c | 4 ++-- ext/standard/basic_functions.c | 2 +- ext/standard/dir.c | 2 +- ext/standard/file.c | 16 ++++++++-------- ext/standard/fsock.c | 2 +- ext/standard/http_fopen_wrapper.c | 2 +- ext/standard/image.c | 2 +- ext/standard/md5.c | 2 +- ext/standard/proc_open.c | 2 +- ext/standard/sha1.c | 2 +- ext/standard/streamsfuncs.c | 4 ++-- ext/tidy/tidy.c | 2 +- ext/xmlwriter/php_xmlwriter.c | 2 +- ext/zlib/zlib.c | 6 +++--- main/main.c | 4 ++-- main/network.c | 2 +- main/streams/streams.c | 8 ++++---- 34 files changed, 64 insertions(+), 64 deletions(-) diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index a063f21c56..07296d2daa 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -327,7 +327,7 @@ PHP_FUNCTION(bzopen) stream = php_stream_bz2open(NULL, Z_STRVAL_PP(file), Z_STRVAL_PP(mode), - ENFORCE_SAFE_MODE | REPORT_ERRORS, + REPORT_ERRORS, NULL); } else { /* If it is a resource, than its a stream resource */ diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 4a4a621e72..43a371ed00 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -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 */ /* do not log errors for .lck file while in read ony mode on .lck file */ 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) { /* 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) { - 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 (lock_dbf) { /* 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) { info->fp = info->lock.fp; /* use the same stream for locking and database access */ } 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) { dba_close(info TSRMLS_CC); diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 7c46f364a4..78b9108bcd 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -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->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) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file"); return FALSE; @@ -4047,7 +4047,7 @@ PHP_FUNCTION(exif_imagetype) WRONG_PARAM_COUNT; 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) { RETURN_FALSE; diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 0c90ba491f..3965794f44 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -684,9 +684,9 @@ PHP_FUNCTION(ftp_get) #endif 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) { - 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 autoresume is wanted seek to end */ @@ -698,7 +698,7 @@ PHP_FUNCTION(ftp_get) } } } 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) { @@ -745,9 +745,9 @@ PHP_FUNCTION(ftp_nb_get) mode = FTPTYPE_IMAGE; #endif 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) { - 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 autoresume is wanted seek to end */ @@ -759,7 +759,7 @@ PHP_FUNCTION(ftp_nb_get) } } } 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) { @@ -941,7 +941,7 @@ PHP_FUNCTION(ftp_put) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); 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; } @@ -994,7 +994,7 @@ PHP_FUNCTION(ftp_nb_put) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); 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; } diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 289540a499..42879b253f 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -607,7 +607,7 @@ PHP_FUNCTION(imageloadfont) 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) { RETURN_FALSE; } @@ -1400,7 +1400,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, 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) { RETURN_FALSE; } diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 64614046fd..25382eaf4d 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -82,7 +82,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) RETURN_FALSE; } 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) { /* Stream will report errors opening file */ RETURN_FALSE; @@ -157,7 +157,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename) RETURN_FALSE; } 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) { /* Stream will report errors opening file */ 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); 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) { /* Stream will report errors opening file */ RETURN_FALSE; diff --git a/ext/hash/hash_md.c b/ext/hash/hash_md.c index 530b9e8db0..1ff0eba63a 100644 --- a/ext/hash/hash_md.c +++ b/ext/hash/hash_md.c @@ -136,7 +136,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) 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) { RETURN_FALSE; } diff --git a/ext/hash/hash_sha.c b/ext/hash/hash_sha.c index 3a21fe37d5..3b1156d5bd 100644 --- a/ext/hash/hash_sha.c +++ b/ext/hash/hash_sha.c @@ -131,7 +131,7 @@ PHP_FUNCTION(sha1_file) 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) { RETURN_FALSE; } diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 67be96b8e3..3f58f11b37 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1886,7 +1886,7 @@ PHP_FUNCTION(imap_savebody) default: 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; } diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 08da6a2ace..9db4d54192 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -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 may try to open files that don't exist, but it is not a failure 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->wops->url_stat(wrapper, path_to_open, PHP_STREAM_URL_STAT_QUIET, &ssbuf, NULL TSRMLS_CC) == -1) { 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()); } - 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) { xmlFree(resolved_path); } diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index 9e76feb16a..b071f68515 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -1060,7 +1060,7 @@ static int magic_process(zval *what TSRMLS_DC) switch (Z_TYPE_P(what)) { 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) { /* We can't open it, but we were able to stat it. */ if(MIME_MAGIC_G(debug)) diff --git a/ext/ming/ming.c b/ext/ming/ming.c index 5cad69f83b..d2df70129c 100644 --- a/ext/ming/ming.c +++ b/ext/ming/ming.c @@ -1422,7 +1422,7 @@ PHP_METHOD(swffont, __construct) php_stream * stream; 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) { RETURN_FALSE; @@ -2387,7 +2387,7 @@ PHP_METHOD(swfmovie, save) } 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) { RETURN_FALSE; diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 4221c7459e..0d6f8ae691 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -913,7 +913,7 @@ PHP_FUNCTION(oci_lob_export) 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; if (block_length > length) { diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 83b4e30ca3..c72b6218de 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -183,7 +183,7 @@ static char *dsn_from_uri(char *uri, char *buf, size_t buflen TSRMLS_DC) php_stream *stream; 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) { dsn = php_stream_get_line(stream, buf, buflen, NULL); php_stream_close(stream); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 4085405dad..d1233cff8b 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2354,7 +2354,7 @@ PHP_FUNCTION(pg_trace) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); 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) { RETURN_FALSE; diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 072c812e5d..1652853bcf 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -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); stream = php_stream_xport_create(name, namelen, - ENFORCE_SAFE_MODE | REPORT_ERRORS, + REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL /*persistent_id*/, timeout, diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c index 7c8ea081e9..760d02abcd 100644 --- a/ext/soap/php_xml.c +++ b/ext/soap/php_xml.c @@ -176,7 +176,7 @@ int php_stream_xmlIO_match_wrapper(const char *filename) void *php_stream_xmlIO_open_wrapper(const char *filename) { 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) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 04f72be878..a5d093bf15 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -174,7 +174,7 @@ static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path TS { intern->type = SPL_FS_DIR; 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 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->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 (!EG(exception)) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 3451c26eba..2548a5c045 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2033,7 +2033,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T break; 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) return FAILURE; php_stream_write(stream, message, strlen(message)); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 09a5beb482..dacdbe7234 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -192,7 +192,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) 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) { RETURN_FALSE; diff --git a/ext/standard/file.c b/ext/standard/file.c index 81bd0f2b77..c9bf705a7d 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -379,7 +379,7 @@ PHP_FUNCTION(get_meta_tags) } 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); if (!md.stream) { @@ -531,7 +531,7 @@ PHP_FUNCTION(file_get_contents) 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, + (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); if (!stream) { RETURN_FALSE; @@ -592,7 +592,7 @@ PHP_FUNCTION(file_put_contents) mode[1] = 't'; } 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) { RETURN_FALSE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(file) 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) { RETURN_FALSE; } @@ -893,7 +893,7 @@ PHP_NAMED_FUNCTION(php_if_fopen) 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) { RETURN_FALSE; } @@ -1491,7 +1491,7 @@ PHP_FUNCTION(readfile) 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) { size = php_stream_passthru(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"); 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; } - 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) { ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS; diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index b1dce06b48..6970c038a4 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -76,7 +76,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) 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); if (port > 0) { diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index ade1652928..8cd1517bc6 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -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_STRLEN_PP(tmpzval) <= 0) { 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) */ request_fulluri = 1; diff --git a/ext/standard/image.c b/ext/standard/image.c index 8b751deed8..f767d14ba4 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1291,7 +1291,7 @@ PHP_FUNCTION(getimagesize) 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) { RETURN_FALSE; diff --git a/ext/standard/md5.c b/ext/standard/md5.c index bf3902484b..add9626200 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -85,7 +85,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) 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) { RETURN_FALSE; } diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 6ab5ec44fc..4225cf7329 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -660,7 +660,7 @@ PHP_FUNCTION(proc_open) /* try a wrapper */ 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 */ if (stream == NULL || FAILURE == php_stream_cast(stream, diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 85c85284a2..75295b5c8c 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -85,7 +85,7 @@ PHP_FUNCTION(sha1_file) 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) { RETURN_FALSE; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index dbbef29632..4dd1dda5be 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -116,7 +116,7 @@ PHP_FUNCTION(stream_socket_client) 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) | (flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0), hashkey, &tv, context, &errstr, &err); @@ -190,7 +190,7 @@ PHP_FUNCTION(stream_socket_server) 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, NULL, NULL, context, &errstr, &err); diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index f6fab3e4e3..0f68eafa81 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -514,7 +514,7 @@ static char *php_tidy_file_to_mem(char *filename, zend_bool use_include_path, in php_stream *stream; 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; } if ((*len = (int) php_stream_copy_to_mem(stream, &data, PHP_STREAM_COPY_ALL, 0)) == 0) { diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index efd76463bd..386c2034c7 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -300,7 +300,7 @@ static void *php_xmlwriter_streams_IO_open_write_wrapper(const char *filename TS php_stream_wrapper *wrapper = 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; } /* }}} */ diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 11c20e0914..36c333c710 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -294,7 +294,7 @@ PHP_FUNCTION(gzfile) use_include_path = flags ? USE_PATH : 0; /* 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) { /* Error reporting is already done by stream code */ RETURN_FALSE; @@ -336,7 +336,7 @@ PHP_FUNCTION(gzopen) 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) { RETURN_FALSE; @@ -365,7 +365,7 @@ PHP_FUNCTION(readgzfile) 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) { RETURN_FALSE; } diff --git a/main/main.c b/main/main.c index 06fe98397e..755fe77519 100644 --- a/main/main.c +++ b/main/main.c @@ -1001,7 +1001,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path { 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; - 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) { handle->type = ZEND_HANDLE_STREAM; diff --git a/main/network.c b/main/network.c index 195a825180..69b0f9f094 100644 --- a/main/network.c +++ b/main/network.c @@ -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); - 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); efree(res); diff --git a/main/streams/streams.c b/main/streams/streams.c index dd98d752a3..87ff73864a 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2222,7 +2222,7 @@ PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_conte { 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) { return 0; } @@ -2237,7 +2237,7 @@ PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *contex { 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) { 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) { ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); if (ret == 0) { @@ -2692,7 +2692,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ return FAILURE; } - stream = php_stream_opendir(dirname, ENFORCE_SAFE_MODE | REPORT_ERRORS, context); + stream = php_stream_opendir(dirname, REPORT_ERRORS, context); if (!stream) { return FAILURE; } -- 2.40.0