Skip to content

Handle bindto error #5903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Handle bindto error #5903

wants to merge 1 commit into from

Conversation

twose
Copy link
Member

@twose twose commented Jul 29, 2020

code:

$ctx = stream_context_create([
    'socket' => [
        'bindto' => 'invalid',
    ],
]);
$fp = stream_socket_client(
    'tcp://www.' . str_repeat('x', 100) . '.com:80',
    $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ctx
);
?>

before:

Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in %s/bindto.php on line 17

Warning: stream_socket_client(): unable to connect to tcp://www.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.com:80 (php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known) in %s/bindto.php on line 17
[Wed Jul 29 12:07:22 2020]  Script:  '%s/bindto.php'
Zend/zend_string.h(133) :  Freeing 0x000000010cd13f00 (224 bytes), script=%s/bindto.php
=== Total 1 memory leaks detected ===

after:

Warning: stream_socket_client(): Unable to connect to tcp://%s:80 (Failed to parse address "invalid") in %s on line %d

@cmb69
Copy link
Member

cmb69 commented Jul 29, 2020

This seems to affect PHP 7.3/7.4 as well.

@php-pulls php-pulls closed this in 0b8c83f Jul 29, 2020
@twose twose deleted the bindto branch July 29, 2020 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants