Doc #76166 [Opn->Csd]: file_get_contents reference has an invalid example

From: Date: Fri, 30 Mar 2018 11:18:42 +0000
Subject: Doc #76166 [Opn->Csd]: file_get_contents reference has an invalid example
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15578@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76166&edit=1 ID: 76166 Updated by: cmb@php.net Reported by: zikyky at gmail dot com Summary: file_get_contents reference has an invalid example -Status: Open +Status: Closed Type: Documentation Problem -Package: Documentation problem +Package: Filesystem function related Operating System: Irrelevant PHP Version: 7.1.16 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2018-03-30 11:17:37] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=344590 Log: Fix #76166: file_get_contents reference has an invalid example ------------------------------------------------------------------------ [2018-03-30 10:24:45] zikyky at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.file-get-contents --- Example #3 uses "NULL" for a boolean parameter, while this works under normal circumstances, it throws a TypeError if strict_types is enabled. The example should use FALSE instead of NULL for the $use_include_path parameter, like this: $section = file_get_contents('./people.txt', FALSE, NULL, 20, 14); Test script: --------------- <?php declare(strict_types=1); // Read 14 characters starting from the 21st character $section = file_get_contents('./people.txt', NULL, NULL, 20, 14); var_dump($section); ?> Expected result: ---------------- string(14) "lle Bjori Ro" Actual result: -------------- Fatal error: Uncaught TypeError: file_get_contents() expects parameter 2 to be boolean, null given in -:4 Stack trace: #0 -(4): file_get_contents('./people.txt', NULL, NULL, 20, 14) #1 {main} thrown in - on line 4 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76166&edit=1

« previous php.doc.bugs (#15578) next »