Suggestion: a renderer for php-serialized data like the one for JSON

olliejones's profile image olliejones posted 3 years ago in Feature discussion Permalink

Considering how popular WordPress is, and how that system, bless its aging heart, uses MariaDB / MySQL to store lots of text strings generated by php serialize:

It would be very helpful if HeidiSQL could optionally parse and render those strings as data structures, like it does with JSON. Of course, pretty-printed JSON is still valid JSON, and rendered php-serialized strings stop being valid php-serialized strings.

But still.

ansgar's profile image ansgar posted 3 years ago Permalink

You mean in the text editor for grids, or where? If so, yes, that's what I would find useful myself, as I'm having serialized strings in many other databases as well.

In issue #202, you see the text editor even cust such PHP serialized strings at the first NUL character. The idea is to strip those NUL chars and make the text readonly.

But that still does not render the text with a syntax highlighter, which is what you're asking. Good thing is SynEdit allows to create and add own highlighters. Probably I can create one for PHP serialized text.

olliejones's profile image olliejones posted 3 years ago Permalink

Yes, I mean in the text editor for grids. In your version 11.3, if I click, inside the grid display, on a JSON item you prettyprint the JSON in the popup editor window. My suggestion is to do the same with that php-serialized data.

Making it read-only will, of course, prevent data corruption if a user tries to edit it.

A better feature might be to allow editing the data structure, then reserializing it before UPDATEing it. But that might be a ridiculous amount of work, as you would have to reimplement a large fraction of php's parser to cover verious possible cases.

Thank you for considering this.

ansgar's profile image ansgar posted 3 years ago Permalink

If you install the latest nightly build of HeidiSQL, you can now at least view such serialized objects in the editor, using spaces instead of NUL characters. Using the JSON highlighter brings you nearly where you want to go:

Description

Please login to leave a reply, or register at first.