Doc #76303 [Opn->Nab]: file_get_contents - 4th parameter default was -1 now its 0
| From: | requinix@php.net | Date: | Sun, 06 May 2018 14:02:53 +0000 |
| Subject: | Doc #76303 [Opn->Nab]: file_get_contents - 4th parameter default was -1 now its 0 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15655@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76303&edit=1
ID: 76303
Updated by: requinix@php.net
Reported by: roland at inkoeln dot com
Summary: file_get_contents - 4th parameter default was -1 now
its 0
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Filesystem function related
Operating System: Linux
PHP Version: 7.2.5
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This particular behavior is documented in at least three locations so there's no reason to not
know about it.
Besides, passing the default values for trailing arguments is silly. Don't do that.
Previous Comments:
------------------------------------------------------------------------
[2018-05-06 13:55:21] roland at inkoeln dot com
Description:
------------
---
From manual page: http://www.php.net/function.file-get-contents
---
in php 5.x upto 7.0.x
file_get_contents('merge.json', false, null, -1);
returns complete file content
in PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
file_get_contents('merge.json', false, null, -1);
return only last character (\n)
This breaks backward compatibility for me
Test script:
---------------
<?php
print file_get_contents('some_file.txt', false, null, -1);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76303&edit=1