I am unable to unserialize()
a backtrace that I serialize()
'd and saved to a text file. I cannot also copy-paste the string, it only copies the data before NULL so I am unable to unserialize it back in PHP.
Here's a small excerpt of what it looks like in Notepad++
Any ideas how to unserialize this?
Note: I am using error_log($backtrace, 3, 'file.log');
to save the file, then simply open in Notepad++ to copy-paste but I can't copy past the NULL character.
So the serialize function identifies member variables with the syntax null*null as you are showing here.
The null character is encoded in a string as \0
and is not usually displayed in output. To unserialize you will need to convert those "null" text back to \0
.
When I write a serialized array I run it through a function that converts \0
to [NULL]
.
$string = str_replace("\0","[NULL]",$string);
Then when you're ready to unserialize you can just do the opposite
$string = str_replace("[NULL]","\0",$string);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With