WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #46570, comment 4


Ignore:
Timestamp:
07/31/2019 07:34:40 AM (7 months ago)
Author:
donmhico
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #46570, comment 4

    v1 v2  
    11I have a question. Instead of using regex to check if a string is in 'serialized-format', why not use PHP's native `unserialize()` to actually unserialize the input string and check for its output. From the PHP docs, `unserialize()` would return either serialized value or `FALSE` if the passed data is not unserializeable.
    22
    3 Of course, what i'm thinking is still returning only either `TRUE` or `FALSE` for the `is_serialized()` and not the actual unserialized value, if it's the return value of the `unserialize()` function.
     3Of course, what i'm thinking is still returning only either `TRUE` or `FALSE` for the `is_serialized()` and not the actual unserialized value, if it's the return value of the `unserialize()` function. I'm guessing that returning the actual unserialized value might posed backward compat issues.
    44
    55See https://www.php.net/manual/en/function.unserialize.php.