Erik Verboom
Erik Verboom

Reputation: 395

Ratchet server User Warning causes Symfony ContextErrorException

So, I'm currently trying to get my symphony (2.7) session data into my Ratchet websocket server by using the SessionProvider component as described on the Ratchet site: http://socketo.me/docs/sessions.

However, every time i try to connect to the Ratchet server it crashes with the message:

[Symfony\Component\Debug\Exception\ContextErrorException]                    
User Warning: XDebug extension detected. Remember to disable this if performance testing or going live! 

Of course i could turn off xDebug, but on my dev environment i would like to use it for debug purposes. Moreover, i feel like a performance warning should not cause a fatal crash! So how can i run a Ratchet web socket server with xDebug enabled?

Upvotes: 4

Views: 375

Answers (1)

StR
StR

Reputation: 560

Ratchet by default triggers an error/warning if you have xdebug enabled. This is because xdebug makes it very slow. For you not to have xdebug enabled in your live environment it crashes with that error message.

But for development environments, you can easily set the flag RATCHET_DISABLE_XDEBUG_WARN to skip that error.

The easiest way to set that flag in your PHP code is:

putenv('RATCHET_DISABLE_XDEBUG_WARN=true');

This was requested and documented in this issue: https://github.com/ratchetphp/Ratchet/issues/576

Upvotes: 0

Related Questions