From 91b587f884a62a831b1468e4a6f609bd576b23aa Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Fri, 15 Apr 2005 17:13:54 +0000 Subject: [PATCH] Remove include_path support from md5_file/sha1_file again --- NEWS | 1 + ext/standard/md5.c | 8 +++----- ext/standard/sha1.c | 8 +++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 27c14f6706..7b2be7cf8b 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,7 @@ PHP NEWS . pg_result_error_field() - highly detailed error information, most importantly the SQLSTATE error code. . pg_set_error_verbosity() - set verbosity of errors. +- Changed sha1_file() / md5_file() to use streams instead of low level IO (Uwe) - Added optional fifth parameter "count" to preg_replace_callback() and preg_replace() to count the number of replacements made. FR #32275. (Andrey) - Added optional third parameter "charlist" to str_word_count() which diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 85d9f4e3ef..00108c49e0 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -67,14 +67,13 @@ PHP_NAMED_FUNCTION(php_if_md5) } /* }}} */ -/* {{{ proto string md5_file(string filename [, bool raw_output [, bool use_include_path]]) +/* {{{ proto string md5_file(string filename [, bool raw_output]) Calculate the md5 hash of given filename */ PHP_NAMED_FUNCTION(php_if_md5_file) { char *arg; int arg_len; zend_bool raw_output = 0; - zend_bool use_include_path = 0; char md5str[33]; unsigned char buf[1024]; unsigned char digest[16]; @@ -82,12 +81,11 @@ PHP_NAMED_FUNCTION(php_if_md5_file) int n; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bb", &arg, &arg_len, &raw_output, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } - stream = php_stream_open_wrapper(arg, "rb", - (use_include_path ? USE_PATH : 0) | REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); + stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); if (!stream) { RETURN_FALSE; } diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 76675cee0d..0e132100d5 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -67,14 +67,13 @@ PHP_FUNCTION(sha1) /* }}} */ -/* {{{ proto string sha1_file(string filename [, bool raw_output [, bool use_include_path]]) +/* {{{ proto string sha1_file(string filename [, bool raw_output]) Calculate the sha1 hash of given filename */ PHP_FUNCTION(sha1_file) { char *arg; int arg_len; zend_bool raw_output = 0; - zend_bool use_include_path = 0; char sha1str[41]; unsigned char buf[1024]; unsigned char digest[20]; @@ -82,12 +81,11 @@ PHP_FUNCTION(sha1_file) int n; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bb", &arg, &arg_len, &raw_output, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } - stream = php_stream_open_wrapper(arg, "rb", - (use_include_path ? USE_PATH : 0) | REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); + stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL); if (!stream) { RETURN_FALSE; } -- 2.50.1