[wp-trac] [WordPress Trac] #46570: the is_serialized function couldn't tell e+n

WordPress Trac noreply at wordpress.org
Wed Jul 31 07:26:42 UTC 2019


#46570: the is_serialized function couldn't tell e+n
----------------------------------------+-----------------------------
 Reporter:  hoythan                     |       Owner:  SergeyBiryukov
     Type:  defect (bug)                |      Status:  reviewing
 Priority:  normal                      |   Milestone:  5.3
Component:  General                     |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+-----------------------------

Comment (by donmhico):

 I 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.

 See https://www.php.net/manual/en/function.unserialize.php.

 I can create a patch that will use this approach, however I'm not sure if
 there's any particular reason why the WP native function `is_serialized()`
 is using regex. I need some input from others first.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46570#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list