tideways/php-xhprof-extension

serialize() vs json_encode()

Closed this issue · 1 comments

1ma commented

I've noticed that all the examples use serialize() to convert the arrays returned by tideways_xhprof_disable() to text.

Is there any reason for not serializing these arrays with json_encode() instead?

@1ma serialize is used, because the default XHProf GUIs uses that format in its decoding. You can of course use json_encode. Although it can break if you use non utf-8 characters in function names (which you shouldn't do and usually is not done).