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

Fix - SocketHandler. Set chunkSize default value #1576

Closed
wants to merge 2 commits into from

Conversation

juan-morales
Copy link
Contributor

Fixes #1570

Sets default value of chunkSize to 65023 (a good reasonable number like a UDP datagram size packet).

At the beggining I tried to set it to PHP_INT_MAX (according the documentation in the php website) but I got the following errors while execution the test testWriteContentWithPlainTextMessage():


stream_set_chunk_size(): The chunk size cannot be larger than 2147483647
 monolog/src/Monolog/Handler/SocketHandler.php:272
 monolog/src/Monolog/Handler/SocketHandler.php:364
 monolog/src/Monolog/Handler/SocketHandler.php:339
 monolog/src/Monolog/Handler/SocketHandler.php:316
 monolog/src/Monolog/Handler/SocketHandler.php:74
 monolog/src/Monolog/Handler/SlackHandler.php:150
 monolog/src/Monolog/Handler/AbstractProcessingHandler.php:48
 monolog/tests/Monolog/Handler/SlackHandlerTest.php:108

I got it with php 7.4

So according the error , the number candidate 2147483647 is the max allowed.

But then I changed my mind and used number 65023, the same used for UDP packets in the UdpHandler in Monolog.

If another number should be use as default, please let me know and I can change the PR asap!

I also fixed/changed some php-doc related issues in the file, and added a simple unit test for this.

Ideas/Suggestions are welcome.

@juan-morales juan-morales changed the title Fix - SocketHandler. Set default value to chunkSize Fix - SocketHandler. Set chunkSize default value Jul 29, 2021
@Seldaek Seldaek closed this in 4b47204 Sep 14, 2021
@Seldaek
Copy link
Owner

Seldaek commented Sep 14, 2021

Thanks but IMO null is a better default, so it uses the default PHP stream chunk size unless explicitly set by a user.

@lyrixx lyrixx mentioned this pull request Aug 16, 2022
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.

TypeError: Return value of Monolog\Handler\SocketHandler::getChunkSize()
3 participants