Fix output buffer error in phpunit>=4.2

Partial fix for #1262
Need improve exception handling. For now we are losing a stack trace and exception's class.
I know but the problem is still there, if you will do it, then other top level code that uses buffers will fail