- Added sqlite_fetch_column_types() 3rd argument for arrays. (Ilia)
- Added optional offset parameter to stream_get_contents() and
file_get_contents(). (Ilia)
+- Added optional maxlen parameter to file_get_contents(). (Ilia)
- Added SAPI hook to get the current request time. (Rasmus)
- Added new functions:
. array_diff_key() (Andrey)
/* }}} */
-/* {{{ 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)
{
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;
}
}
/* 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 */