diff options
| -rw-r--r-- | ext/standard/file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 1b61f17804..870972b366 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -536,6 +536,11 @@ PHP_FUNCTION(file_get_contents) return; } + if (ZEND_NUM_ARGS() == 5 && maxlen < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater than or equal to zero"); + RETURN_FALSE; + } + context = php_stream_context_from_zval(zcontext, 0); stream = php_stream_open_wrapper_ex(filename, "rb", @@ -545,11 +550,6 @@ PHP_FUNCTION(file_get_contents) RETURN_FALSE; } - if (maxlen < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to zero"); - RETURN_FALSE; - } - if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", offset); php_stream_close(stream); |
