From 0d02c7d3374025f15cc59a9c5e3ec54b66603dc0 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Dec 2000 17:42:53 +0000 Subject: [PATCH] Open files in binary mode - should fix readfile() on Windows --- ext/standard/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index d421230de7..854bdeb083 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -271,7 +271,7 @@ PHP_FUNCTION(get_meta_tags) } convert_to_string_ex(filename); - fp = php_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); + fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); if (!fp && !socketd) { if (issock != BAD_URL) { char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename)); @@ -406,7 +406,7 @@ PHP_FUNCTION(file) } convert_to_string_ex(filename); - fp = php_fopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); + fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); if (!fp && !socketd) { if (issock != BAD_URL) { char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename)); @@ -1405,7 +1405,7 @@ PHP_FUNCTION(readfile) * We need a better way of returning error messages from * php_fopen_wrapper(). */ - fp = php_fopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); + fp = php_fopen_wrapper((*arg1)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL); if (!fp && !socketd){ if (issock != BAD_URL) { char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)); -- 2.40.0