Skip to content

Conversation

@sonarta
Copy link

@sonarta sonarta commented Dec 10, 2025

Problem

Users report StreamException: Stream timed out error when using PHP 8.4, particularly when retrieving large amounts of data.

Solution

  • Replace socket_get_status() with stream_get_meta_data() for clarity
  • Only throw timeout exception when timed_out=true AND no data received
  • Add configurable throw_timeout_exception option

Testing

Tested on PHP 8.4.15 with RouterOS 7.12.1:

  • ✅ 12 stress tests passed
  • ✅ 72,788 total records retrieved
  • ✅ Zero stream timeout errors

Usage

If issues persist, disable timeout exception:

$client = new Client([
    'throw_timeout_exception' => false,
]);

Fixes #131

- Replace socket_get_status() with stream_get_meta_data() for clarity
- Only throw timeout exception when timed_out=true AND no data received
- Add configurable 'throw_timeout_exception' option to disable timeout checks
- Update Laravel config with ROUTEROS_THROW_TIMEOUT_EXCEPTION env var

Tested on PHP 8.4.15 with RouterOS 7.12.1, retrieved 72,788 records successfully.

Fixes: EvilFreelancer#131
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.

PHP8.4 connection error

1 participant