[wp-trac] [WordPress Trac] #20712: Wrong data type returned from get_option for "page_on_front" after update_option
WordPress Trac
wp-trac at lists.automattic.com
Sun May 20 09:05:57 UTC 2012
#20712: Wrong data type returned from get_option for "page_on_front" after
update_option
--------------------------+------------------------------
Reporter: tszming | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.3.2
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by tszming):
The funniest thing is when you replace `page_on_front` with another option
such as `blog_public` then it would be okay. (both return strings in my
code above)
Anyway, since the datatype is changed, so when I execute the
`update_option` twice, e.g.
{{{
echo gettype(get_option("page_on_front")); // return string
update_option("page_on_front", "123");
echo gettype(get_option("page_on_front")); // return integer
update_option("page_on_front", "123");
}}}
Need to be careful as the following lines of code does not work
{{{
function update_option( $option, $newvalue ) {
...
// If the new and old values are the same, no need to update.
if ( $newvalue === $oldvalue )
return false;
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20712#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list