[RFC] Unset possible xdebug_messages in PHPRenderer on Exception

Background:

If a non existing form fieldset/element should be rendered, and xdebug is currently enabled, the exception will contain a public property called xdebug_message containing html formatted message.

That message will be huge (500+MB in my case) depending on the complexity of the form.

For most browser this will result in

  • waiting a long time
  • and finally get a blank page as the amount of data is too big

I you don’t look at the network manager you’ll have no clue what is going on.

Q A
New Feature yes
RFC yes
BC Break no

Summary

I would suggest to check for that property and unset it, if it is there.
The real stack trace is not affected so you still can see where the error is.

These catch blocks should be modified:
https://github.com/laminas/laminas-view/blob/master/src/Renderer/PhpRenderer.php#L507 + 510

I opened this PR for the changes. https://github.com/laminas/laminas-view/pull/42

Hello and welcome to forums! :smiley:

Unfortunately I can not reproduce the problem. Please see the related your own issue report.
Apart from that, the solution – when one is needed – cannot be a new dependency on laminas-form.