#1275 Comfortable editing of serialize()'d data

Parsing (9)

When storing objects into it's database, the CMS Drupal first stores each value for which a column exists into the corresponding column and uses the serialize() function to store the remaining ones into a single, additional LONGTEXT column. (I expect other frameworks to behave similarly.)

Editing such a field by hand is quite painful, as one has to keep track of character counts, syntax, etc. I'd appreciate having a more comfortable way to edit them.

I wrote a Javascript to demonstrate what I'm thinking of and tested it in both FF 3.5 and Chromium. I guess a PHP-only implementation would be more robust, since it can use PHP's native serialize() implementation. Also, my current version does not allow insertion/deletion of fields. I'll attach it as-is (needs to be included into tbl_change.php) and as a patch against Commit da6cf1b878401b3f509c9294d46864b0d6bd82dd. To test it, edit a row which contains a longtext field which contains JSON or serialize()'d data. A link "Edit serialized data" should appear below the textfield, opening a JQuery-dialog field when clicked upon.


  • Michal Čihař

    Michal Čihař - 2011-01-13

    The problem with serialized data is that they can contain object with __wakeup calls, so it's unsafe to do this in PHP using native unserialize() function. With own implementation it is possible to workaround this, but I don't see much difference making it in javascript or PHP.

  • Michal Čihař

    Michal Čihař - 2011-01-13

    The patch seems to be okay, but we're currently in strings/feature freeze for 3.4, so it can be merged afterwards (or look for PHP based solution).

  • Phillip Berndt

    Phillip Berndt - 2011-02-21

    I updated serialized.js (ONLY that file, I did not update the patch) to account for the incompleteness of my implementation: There are actually two more types of serialized data types in PHP, for which I have now implemented meaningful error messages.

    If you'd serialize
    $a->foo = "bar";
    $a->bar = &$a->foo;
    You'd get

    Support for both types could be added in the future. Right now the script won't offer editing of fields containing them.

  • Phillip Berndt

    Phillip Berndt - 2011-02-21


  • Tom Robinson

    Tom Robinson - 2012-04-03

    Comfortable editing of json would be great. It is a well-documented standard.
    Personally, I would have no use for editing "serialize" data, as I have control over my own apps and have long ago switched them to use json for storing structured data in a LONGTEXT column.

  • Marc Delisle

    Marc Delisle - 2015-02-15
    • Priority: 5 --> Normal
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne
    • Group: --> Needs_decision
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne --> nobody

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks