php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77938 socket_get_option error
Submitted: 2019-04-24 21:07 UTC Modified: 2019-04-24 22:03 UTC
From: v-altruo at microsoft dot com Assigned: cmb (profile)
Status: Closed Package: Testing related
PHP Version: 7.2.18RC1 OS: Windows
Private report: No CVE-ID: None
 [2019-04-24 21:07 UTC] v-altruo at microsoft dot com
Description:
------------
Failed regardless of OPCache being enabled or disabled and if it was TS or NTS.
Test file location: ext\standard\tests\stream\stream_context_tcp_nodelay_fopen.phpt

Test script:
---------------
$ctxt = stream_context_create([
	"socket" => [
		"tcp_nodelay" => true
	]
]);

$stream = fopen("http://www.php.net", "r", false,  $ctxt);

$socket =
	@socket_import_stream($stream);

var_dump(socket_get_option($socket, STREAM_IPPROTO_TCP, TCP_NODELAY) > 0);

Expected result:
----------------
bool(true)

Actual result:
--------------
Warning: socket_get_option() expects parameter 1 to be resource, boolean given in... 
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-24 21:11 UTC] requinix@php.net
-Status: Open +Status: Verified
 [2019-04-24 21:11 UTC] requinix@php.net
Warning: socket_import_stream(): cannot represent a stream of type tcp_socket/ssl as a Socket Descriptor

Broken by the new HTTPS redirect. Adding
  "http" => ["follow_location" => 0]
to the options array works.
 [2019-04-24 22:03 UTC] cmb@php.net
-Package: Streams related +Package: Testing related -Assigned To: +Assigned To: cmb
 [2019-04-24 22:03 UTC] cmb@php.net
Thanks for reporting!  As requinix said, the test has to be fixed
to cater to the recently introduced HTTPS redirect of www.php.net
(the warning is suppressed due to the @ operator).
 [2019-04-24 22:09 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fe202d99c8fff957509375411641687f47dfc17b
Log: Fix #77938: socket_get_option error
 [2019-04-24 22:09 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC