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

WordPress Trac noreply at wordpress.org
Wed Jul 31 18:47:31 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 SergeyBiryukov):

 Replying to [comment:4 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.

 We needed a function that can detect serialized data without doing an
 actual unserialize test on it. See [4382] and the discussion in #2591.

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


More information about the wp-trac mailing list