|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
Patchesopenssl-ignore-eof.patch (last revision 2022-03-29 11:55 UTC by arekm at maven dot pl)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 01:00:01 2025 UTC |
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ávelphp master as of today: commit c9c5ee3f48a21c8911d2e1c68c4e0ca5d5f58840 (HEAD -> master, origin/master, origin/HEAD) Merge: a6d88d3b26 7e8dcda42c Author: Christoph M. Becker <cmbecker69@gmx.de> Date: Tue Mar 29 10:54:32 2022 +0200 Merge branch 'PHP-8.1' build simplest way possible ./configure --prefix=$HOME/test/php-test --with-openssl make make install with OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022) linux distro, glibc 2.35 and php-test]$ ./bin/php ~/ssl-test1.php Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000126:SSL routines::unexpected eof while reading in /home/users/arekm/ssl-test1.php on line 4 $ cat /home/users/arekm/ssl-test1.php <?php $recaptcha_url = 'https:// www. google. com/recaptcha/api/siteverify'; // remove spaces file_get_contents($recaptcha_url);# # OpenSSL example configuration file. # See doc/man5/config.pod for more info. # # This is mostly being used for generation of certificate requests, # but may be used for auto loading of providers # Note that you can include other files from the main configuration # file using the .include directive. #.include filename # This definition stops the following lines choking if HOME isn't # defined. HOME = . # Use this in order to automatically load providers. openssl_conf = openssl_init # Comment out the next line to ignore configuration errors config_diagnostics = 1 # Extra OBJECT IDENTIFIER info: # oid_file = $ENV::HOME/.oid oid_section = new_oids # To use this configuration file with the "-extfile" option of the # "openssl x509" utility, name here the section containing the # X.509v3 extensions to use: # extensions = # (Alternatively, use a configuration file that has only # X.509v3 extensions in its main [= default] section.) [ new_oids ] # We can add new OIDs in here for use by 'ca', 'req' and 'ts'. # Add a simple OID like this: # testoid1=1.2.3.4 # Or use config file substitution like this: # testoid2=${testoid1}.5.6 # Policies used by the TSA examples. tsa_policy1 = 1.2.3.4.1 tsa_policy2 = 1.2.3.4.5.6 tsa_policy3 = 1.2.3.4.5.7 [openssl_init] providers = provider_sect # Load default TLS policy configuration ssl_conf = ssl_module # Uncomment the sections that start with ## below to enable the legacy provider. # Loading the legacy provider enables support for the following algorithms: # Hashing Algorithms / Message Digests: MD2, MD4, MDC2, WHIRLPOOL, RIPEMD160 # Symmetric Ciphers: Blowfish, CAST, DES, IDEA, RC2, RC4,RC5, SEED # Key Derivation Function (KDF): PBKDF1 # In general it is not recommended to use the above mentioned algorithms for # security critical operations, as they are cryptographically weak or vulnerable # to side-channel attacks and as such have been deprecated. [provider_sect] default = default_sect ##legacy = legacy_sect ## [default_sect] activate = 1 ##[legacy_sect] ##activate = 1