From: Stanislav Malyshev Date: Tue, 12 Dec 2000 17:42:53 +0000 (+0000) Subject: Open files in binary mode - should fix readfile() on Windows X-Git-Tag: php-4.0.5RC1~921 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d02c7d3374025f15cc59a9c5e3ec54b66603dc0;p=php Open files in binary mode - should fix readfile() on Windows --- 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));