|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-10-19 11:16 UTC] code at luigifab dot fr
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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Seems to be related to the switch to HTTP 1.1. I get the old result when forcing HTTP 1.0 using $ctx = stream_context_create(['http' => ['protocol_version' => '1.0']]);