|
|
|
@ -506,7 +506,7 @@ PHP_FUNCTION(get_meta_tags) |
|
|
|
|
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset]]]) |
|
|
|
/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) |
|
|
|
Read the entire file into a string */ |
|
|
|
PHP_FUNCTION(file_get_contents) |
|
|
|
{ |
|
|
|
@ -517,12 +517,13 @@ PHP_FUNCTION(file_get_contents) |
|
|
|
php_stream *stream; |
|
|
|
int len, newlen; |
|
|
|
long offset = -1; |
|
|
|
long maxlen = PHP_STREAM_COPY_ALL; |
|
|
|
zval *zcontext = NULL; |
|
|
|
php_stream_context *context = NULL; |
|
|
|
|
|
|
|
/* Parse arguments */ |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|br!l", |
|
|
|
&filename, &filename_len, &use_include_path, &zcontext, &offset) == FAILURE) { |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|br!ll", |
|
|
|
&filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -541,7 +542,7 @@ PHP_FUNCTION(file_get_contents) |
|
|
|
} |
|
|
|
|
|
|
|
/* uses mmap if possible */ |
|
|
|
if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) > 0) { |
|
|
|
if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) { |
|
|
|
|
|
|
|
if (PG(magic_quotes_runtime)) { |
|
|
|
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */ |
|
|
|
|