Bug #80256 [NEW]: file_get_contents strip first line

From: Date: Mon, 19 Oct 2020 11:16:40 +0000
Subject: Bug #80256 [NEW]: file_get_contents strip first line
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229738@lists.php.net to get a copy of this message
From:             code at luigifab dot fr
Operating system: Debian with Docker
PHP version:      8.0.0RC2
Package:          *General Issues
Bug Type:         Bug
Bug description:file_get_contents strip first line

Description:
------------
I try to read an export of a Google Sheet with file_get_contents.
With PHP 8, the first line of the export "is removed".

Test script:
---------------
error_reporting(E_ALL);
ini_set('display_errors', 1);

$data =
file_get_contents('https://docs.google.com/spreadsheets/d/e/2PACX-1vTqS3j4Wd-Bt7Zb52eJiQed_NilvKo0wGdw8noL4vhFOPsUeV9O6EN8odni6YepDGicYApcJ4Zy5opv/pub?gid=1790927668&single=true&output=tsv');
echo 'version:   ',PHP_VERSION,"\n";
echo 'mb_strlen: ',mb_strlen($data),"\n";
echo substr(print_r($data, true), 0, 50),"\n";


Expected result:
----------------
The truth:

php7.2 /var/www/filegetcontents.php
version:   7.2.34-4+0~20201018.51+debian10~1.gbpc553f7
mb_strlen: 187473
config\ten-US (english/Simple)\t\tfr-FR (français/Fr

php7.3 /var/www/filegetcontents.php
version:   7.3.23-4+0~20201018.71+debian10~1.gbpfc8934
mb_strlen: 187473
config\ten-US (english/Simple)\t\tfr-FR (français/Fr

php7.4 /var/www/filegetcontents.php
version:   7.4.11
mb_strlen: 187473
config\ten-US (english/Simple)\t\tfr-FR (français/Fr

(I have replaced the tabulation character with \t)

Actual result:
--------------
php8.0 /var/www/filegetcontents.php 
version:   8.0.0RC2
mb_strlen: 186973
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\t540 cases do

(I have replaced the tabulation character with \t)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80256&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80256&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80256&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80256&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80256&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80256&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80256&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80256&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80256&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80256&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80256&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80256&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80256&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80256&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80256&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80256&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80256&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80256&r=mysqlcfg


Thread (8 messages)

« previous php.bugs (#229738) next »