php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80193 Sample code correction
Submitted: 2020-10-07 07:43 UTC Modified: 2020-10-07 07:48 UTC
From: shaun at slickdesign dot com dot au Assigned: cmb (profile)
Status: Closed Package: Website problem
PHP Version: 7.4.11 OS:
Private report: No CVE-ID: None
 [2020-10-07 07:43 UTC] shaun at slickdesign dot com dot au
Description:
------------
Hi Team,

It's been pointed out to me that I have an error in the sample code of one of my comments and I am unsure how to correct the issue. The comment is question is one I submitted about 2 years ago, and it can be found here:
https://www.php.net/manual/en/function.fgetcsv.php#122696

I'm unsure if the example I provided is how I would do things now, but the point remains that the sample code does not work because one of the variable names is incorrect.

The line in question is as follows:
if (fgets($fp, 4) !== $fp) {

The correction would be to change the second variable from $fp to $bom. Example:
if (fgets($fp, 4) !== $bom) {

If you are able to correct my mistake, that would be greatly appreciated.

Thanks, Shaun.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-07 07:48 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-10-07 07:48 UTC] cmb@php.net
The code has been fixed.  It will take a while until the change is
rolled out to the Website.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 10:01:30 2024 UTC