Bug #76196 [NEW]: proxied file_get_contents calls lag the cert check one behind for further calls

From: Date: Sun, 08 Apr 2018 11:25:14 +0000
Subject: Bug #76196 [NEW]: proxied file_get_contents calls lag the cert check one behind for further calls
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214644@lists.php.net to get a copy of this message
From: php dot public at consistency dot at Operating system: win7 & debian9 PHP version: 7.1.16 Package: Streams related Bug Type: Bug Bug description:proxied file_get_contents calls lag the cert check one behind for further calls Description: ------------ calling file_get_contents through a configured proxy to an ssl site will let the certificate check "lag" one behind. with the first call of the file_get_contents the certificate for the requested site will be "locked in" for the next call. which will therefor fail. so only the first call of file_get_contents will be successful, the rest will fail. Test script: --------------- <?php $stream_default_opts = [ 'http' => [ 'proxy'=>"tcp://5.9.78.28:3128", 'request_fulluri' => true, ] ]; stream_context_set_default($stream_default_opts); file_get_contents("https://www.symfony.com", false); file_get_contents("https://getcomposer.org", false); file_get_contents("https://github.com", false); Actual result: -------------- Warning: file_get_contents(): Peer certificate CN=`getcomposer.org' did not match expected CN=`www.symfony.com' in foo.php on line 11 Warning: file_get_contents(https://getcomposer.org): failed to open stream: Cannot connect to HTTPS server through proxy in foo.php on line 11 Warning: file_get_contents(): Peer certificate CN=`github.com' did not match expected CN=`www.symfony.com' in foo.php on line 12 Warning: file_get_contents(https://github.com): failed to open stream: Cannot connect to HTTPS server through proxy in foo.php on line 12 -- Edit bug report at https://bugs.php.net/bug.php?id=76196&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76196&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76196&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76196&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76196&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76196&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76196&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76196&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76196&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76196&r=support Expected behavior: https://bugs.php.net/fix.php?id=76196&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76196&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76196&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76196&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76196&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76196&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76196&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76196&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76196&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76196&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76196&r=mysqlcfg

« previous php.bugs (#214644) next »