[wp-trac] [WordPress Trac] #28480: is_serialized() returns wrong value
WordPress Trac
noreply at wordpress.org
Tue Jun 10 03:24:28 UTC 2014
#28480: is_serialized() returns wrong value
-------------------------------------------------+-------------------------
Reporter: extendwings | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Database | Review
Severity: normal | Version: 3.9.1
Keywords: has-patch needs-testing reporter- | Resolution:
feedback | Focuses:
-------------------------------------------------+-------------------------
Changes (by csixty4):
* keywords: has-patch needs-testing => has-patch needs-testing reporter-
feedback
Comment:
I think I see the cause of some of the confusion here.
In this line of code:
{{{
if ( false !== $semicolon && $semicolon < 3 )
}}}
$semicolon actually contains the position of the first semicolon in the
string:
{{{
$semicolon = strpos( $data, ';' );
}}}
which should be 23 for the string you provided. It's not looking at how
may semicolons there are, just that there shouldn't be a semicolon in the
first four characters of a valid serialized PHP value.
Still trying to find a way to reproduce this issue. Any special PHP or
WordPress configuration you can think of? I added setlocale(LC_ALL, 'ja');
to my test rig and changed the second is_serialized parameter to false --
i.e. is_serialized('a:1:{s:11:"contributor";b:1;}', false) but it still
returns true for that string.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28480#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list