Skip to content
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

strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated #1002

Closed
jupitern opened this issue Mar 14, 2023 · 3 comments
Labels

Comments

@jupitern
Copy link

PHP 8.1

strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated on /var/www/app/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php line 88

stacktrace:
"#1 /var/www/app/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(88): strpos()",
"#2 /var/www/app/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Ratchet\Server\IoServer->handleConnect()",
"#3 /var/www/app/vendor/react/socket/src/SocketServer.php(72): Evenement\EventEmitter->emit()",
"#4 /var/www/app/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Socket\SocketServer->React\Socket\{closure}()",
"#5 /var/www/app/vendor/react/socket/src/TcpServer.php(255): Evenement\EventEmitter->emit()",
"#6 /var/www/app/vendor/react/socket/src/TcpServer.php(235): React\Socket\TcpServer->handleConnection()",
"#7 /var/www/app/vendor/react/event-loop/src/StreamSelectLoop.php(246): React\Socket\TcpServer->React\Socket\{closure}()",
"#8 /var/www/app/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\EventLoop\StreamSelectLoop->waitForStreamActivity()",
"#9 /var/www/app/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(74): React\EventLoop\StreamSelectLoop->run()"

@SimonFrings
Copy link

I'm currently working on testing this project against PHP 8.0, PHP 8.1 and PHP 8.2, so I opened up a ticket to post my progress in, see #1003.

@clue clue added the invalid label Mar 15, 2023
@clue
Copy link
Member

clue commented Mar 15, 2023

@jupitern Please take the time to properly report issues. I'm not sure what you're reporting is a bug or issue in this project, so I can only assume this is related to #1003 and will close this for now. Please report back and add more details otherwise.

@Gkiokan
Copy link

Gkiokan commented Nov 2, 2023

It is probably only a deprecation warning that spams the logs full on each call.
Probably.

The issue happens on this IoServer.php:88.

And can be probably fixed by adding an alternative fallback to the $uri variable before.
But this would be just a quick fix to stop the deprecation warnings, as everything seems to work fine.
Change this from:

        $uri = $conn->getRemoteAddress();

to

        $uri = $conn->getRemoteAddress() ?? '';

The more correct way would be to debug down why $conn->getRemoteAddress() returns null instead of any valid address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants