I'm trying to serialize the exceptions generated by errors to write a log with all the information, but the problem is that some exceptions may come with a closure
within the trace and trigger the message below:
Uncaught exception 'Exception' with message 'Serialization of' Closure 'is not allowed'
If I write a file using the object $exception
it writes using the magic method __toString
. I wanted to write the complete exception , so I use serialize / unserialize
.
From what I saw, a closure
object can not be serialized, so how can I remove it from the trace exception and serialize it? My final wish is to use OB*
for this.