php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #35306 file_get_contents does not take 5 parameters as specified in PHP Manual
Submitted: 2005-11-20 21:31 UTC Modified: 2005-11-20 22:09 UTC
From: kpeters at monolithss dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: SuSE Linux 9.3
Private report: No CVE-ID: None
 [2005-11-20 21:31 UTC] kpeters at monolithss dot com
Description:
------------
On both PHP 4.3.10 and PHP 5.0.3, when attempting to call file_get_contents with five parameters as specified in the manual (http://us3.php.net/manual/en/function.file-get-contents.php) I get the following errors:

PHP 4.3.10:  
"Warning: file_get_contents() expects at most 2 parameters, 5 given"

PHP 5.0.3:
"PHP Warning:  file_get_contents() expects at most 3 parameters, 5 given"


Reproduce code:
---------------
$file = file_get_contents($filename, null, null, $offset, $maxlength);

Expected result:
----------------
I should get up to $maxlength bytes starting from $offset in $filename.

Actual result:
--------------
warning message as described above.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-20 21:34 UTC] derick@php.net
Read that page fully and you see it is correct.
 [2005-11-20 22:09 UTC] kpeters at monolithss dot com
OK, I see that now.  It's still a bit obscure, though.  I 
suggest that a warning be added that on PHP < 5.1.0 only 
the three-parameter form is valid, and on PHP < 5.0.0 only 
the two-parameter form is valid.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 19:00:01 2025 UTC