Skip to content

[v1.11.0] Accessing array offset on null value - Failed TCP connection without ext-sockets #286

Closed
@matheusb-comp

Description

@matheusb-comp

I'm receiving the following error in this line:

   ErrorException  : Trying to access array offset on value of type null

  at /var/www/html/vendor/react/socket/src/TcpConnector.php:123
    119|                         @\fwrite($stream, \PHP_EOL);
    120|                         $error = \error_get_last();
    121| 
    122|                         // fwrite(): send of 2 bytes failed with errno=111 Connection refused
  > 123|                         \preg_match('/errno=(\d+) (.+)/', $error['message'], $m);
    124|                         $errno = isset($m[1]) ? (int) $m[1] : 0;
    125|                         $errstr = isset($m[2]) ? $m[2] : $error['message'];
    126|                     } else {
    127|                         // Not on Linux and ext-sockets not available? Too bad.

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Trying to access array offset on value of type null", "/var/www/html/vendor/react/socket/src/TcpConnector.php")
      /var/www/html/vendor/react/socket/src/TcpConnector.php:123

  2   React\Socket\TcpConnector::React\Socket\{closure}()
      /var/www/html/vendor/react/event-loop/src/StreamSelectLoop.php:253

  Please use the argument -v to see more details.

The $error is null, but I have no idea why.
I'm using another library that depends on this one indirectly.

The composer require tree:

beyondcode/laravel-websockets 1.8.1 An easy to use WebSocket server
├──cboden/ratchet ^0.4.1
│  └──react/socket ^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5
└──clue/buzz-react ^2.5
   ├──react/http-client ^0.5.10
   |  └──react/socket ^1.0 || ^0.8.4
   └──react/socket ^1.1

PHP version:

PHP 7.4.27 (cli) (built: Dec 16 2021 22:42:18) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions