Limenius / ReactRenderer

Client and Server-side React rendering from PHP
MIT License
237 stars 37 forks source link

Fix infinit loop when stream_socket_client return false #24

Closed mykiwi closed 5 years ago

mykiwi commented 5 years ago

Hi

I have an issue with the package. When my SSR server is down, my PHP app fails: Error: Maximum execution time of 30 seconds exceeded

If you don't check stream_socket_client, $sock could be equals to false.

while (!feof($sock)) { // while (true)

https://3v4l.org/OWO3q

error_reporting | fread() expects parameter 1 to be resource, boolean given
line            | 68
code            | 2
file            | /app/vendor/limenius/react-renderer/src/Limenius/ReactRenderer/Renderer/ExternalServerReactRenderer.php
deguif commented 5 years ago

Nice @mykiwi , I already encountered the problem too, I have patched this locally for the moment, but would be nice to include it mainstream.

mykiwi commented 5 years ago

Any news @nacmartin ?

nacmartin commented 5 years ago

thanks @mykiwi