Skip to content

PHP8.4 connection error #131

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

Open
4wifi opened this issue Jan 12, 2025 · 2 comments
Open

PHP8.4 connection error #131

4wifi opened this issue Jan 12, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@4wifi
Copy link

4wifi commented Jan 12, 2025

Trying to make a connection to the router with PHP 8.4 (FPM) fails with this error. No other changes made other than swapping from php82-php-fpm to php84-php-fpm

PHP Fatal error: Uncaught RouterOS\Exceptions\StreamException: Stream timed out in XXXX/evilfreelancer/routeros-api-php/src/Streams/ResourceStream.php:55
Stack trace:
#0 XXXX/evilfreelancer/routeros-api-php/src/APILengthCoDec.php(115): RouterOS\Streams\ResourceStream->read()
#1 XXXX/evilfreelancer/routeros-api-php/src/APIConnector.php(53): RouterOS\APILengthCoDec::decodeLength()
#2 XXXX/vendor/evilfreelancer/routeros-api-php/src/Client.php(255): RouterOS\APIConnector->readWord()
#3 XXXX/vendor/evilfreelancer/routeros-api-php/src/Client.php(310): RouterOS\Client->readRAW()
#4 XXXX/RouterOS.php(906): RouterOS\Client->read()

Have rolled back for now, will look at writing REST equiv of my class but like your old-API just fine and wondered if there was an easy fix.

Please do not just link back to the readme, the code work PERFECTLY on PHP8.2 but when moving to PHP8.4 with the exact same list of installed packages it fails with this error. API is enabled in both instances on the router and has been working perfectly for a long time.

@4wifi 4wifi added the bug Something isn't working label Jan 12, 2025
@EvilFreelancer
Copy link
Owner

Hi, @4wifi !

The "Stream timed out" exception typically occurs when the router is inaccessible through the API from the server hosting the application that uses this library. This is why I referred you to article in documentation, because approximately two-thirds of the issues reported in this repository are related to this problem.

That said, there might indeed be some issues with PHP 8.4. I recall seeing similar reports about version 8.3, but I was unable to reproduce the problem myself.

Additionally, I currently do not have a spare time to actively maintain this library. However, if you find this library valuable and would like to contribute, you are welcome to submit a pull request with your fixes. I will review, merge it, and tag a new release.

Let me know if you'd like any adjustments!

@okriiza
Copy link

okriiza commented Apr 23, 2025

I tried several versions of php8.2 php8.3 and php 8.4,

on php8.2.27 it runs normally but on php8.3 it can't, when I retrieve data stream time out,
then I tried on php8.4, on php8.4.4 and below I tried to retrieve the same data can't retrieve data description stream time out,

but when I tried on php8.4.5 and the latest php8.4.6 it can, no stream timeout occurs when retrieving data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants