5
I am trying to serialize the error generated exceptions to record a log with all the information, but the problem is that some exceptions may come with a closure
within the trace and fire the message below:
Uncaught Exception 'Exception' with message 'Serialization of 'Closure' is not allowed'
If I write a file using the object $exception
it records using the magic method __toString
. I wanted to record the Exception therefore the use of the serialize / unserialize
.
From what I saw, an object closure
cannot be serialized, so how can I remove from the trace of Exception and serialize it? My last wish is to use OB*
for that reason.
The biggest problem is this __Construct of that pack that gets a type Closure, but I will not always have it within the trace of Exception. Closures are part of the composition of the view, they are not important as log.
– Papa Charlie
@Papacharlie then you actually want to ignore the Closures when it comes to serializing?
– gmsantos
At the moment I loop us Traces to remove the index args. The closures are irrelevant in my case, so I found it simpler to discard them from Exception.
– Papa Charlie