php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79589 error:14095126:SSL routines:ssl3_read_n:unexpected eof while reading
Submitted: 2020-05-12 10:21 UTC Modified: 2020-08-16 16:11 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:1 (20.0%)
From: mumu at seznam dot cz Assigned:
Status: Re-Opened Package: OpenSSL related
PHP Version: 7.4.5 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-05-12 10:21 UTC] mumu at seznam dot cz
Description:
------------
I have started to receiving
file(): SSL operation failed with code 1. OpenSSL Error messages:
error:14095126:SSL routines:ssl3_read_n:unexpected eof while reading
while trying to run 
file('https://www.cnb.cz/cs/financni-trhy/devizovy-trh/kurzy-devizoveho-trhu/kurzy-devizoveho-trhu/denni_kurz.txt?date=11.05.2020', FILE_IGNORE_NEW_LINES);

This issue opened against OpenSSL might be related:
https://github.com/openssl/openssl/issues/11381

If I understand the OpenSSL issue thread correctly, they:
- They are confident the OpenSSL code change triggering this error is valid but they rollback the change in 1.1.1f to not break backward compatibility while keeping the code in future major versions.
- They insists the underlaying issue lays in softwares using OpenSSL as the software does not close the SSL session correctly - see https://github.com/openssl/openssl/issues/11381#issuecomment-602229519


Test script:
---------------
<?php

$lines = file('https://www.cnb.cz/cs/financni-trhy/devizovy-trh/kurzy-devizoveho-trhu/kurzy-devizoveho-trhu/denni_kurz.txt?date=11.05.2020', FILE_IGNORE_NEW_LINES);

dump_var($lines);

Expected result:
----------------
File is properly downloaded.

Actual result:
--------------
file(): SSL operation failed with code 1. OpenSSL Error messages: error:14095126:SSL routines:ssl3_read_n:unexpected eof while reading

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-12 10:56 UTC] cmb@php.net
Well, the good news is that PHP 7.3.18RC1 and 7.4.6RC1 already
ship with OpenSSL 1.1.1g, so the immediate problem is solved.

The bad news is that there may indeed be an issue with our OpenSSL
usage.
 [2020-05-12 10:57 UTC] cmb@php.net
-Package: Filesystem function related +Package: OpenSSL related
 [2020-05-30 20:53 UTC] huzaifarasheen900 at mail dot com
I Just want to add something.I did this with normal php and it worked fine but with the php laravel framework it gives me the same error.
My php version 7.4.5,OS Win10 Pro 2019 in laravel 6.
 [2020-07-15 11:27 UTC] wrfrodrigues at gmail dot com
Olá. Estou tendo o mesmo problema que o huzaifarasheen900 informou.

linha de teste: 

$var = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . SECRET_KEY . "&response={$SecretKey}");

Resultado:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14095126:SSL routines:ssl3_read_n:unexpected eof while reading in D:\Projetos\Paginas de Teste\ClassCaptcha.php on line 14

Meu php versão 7.4.5,OS Win10 sem lavável
 [2020-07-20 13:14 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-07-20 13:14 UTC] cmb@php.net
> My php version 7.4.5,OS Win10 Pro 2019 in laravel 6.

> Meu php versão 7.4.5,OS Win10 sem lavável

Thanks.  This issue is resolved as of PHP 7.4.6.
 [2020-08-16 15:50 UTC] bukka@php.net
-Status: Closed +Status: Re-Opened -Operating System: Windows 2012 R2 +Operating System:
 [2020-08-16 15:50 UTC] bukka@php.net
This will still need to be fixed for OpenSSL 3.0 so re-opening and removing OS
 [2020-08-16 16:11 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 04:01:23 2020 UTC