[wp-trac] [WordPress Trac] #4781: update_option destroys value /
faulty trim
WordPress Trac
wp-trac at lists.automattic.com
Mon Aug 20 15:45:18 GMT 2007
#4781: update_option destroys value / faulty trim
----------------------------+-----------------------------------------------
Reporter: hakre | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.2.3
Component: Administration | Version: 2.2.2
Severity: normal | Keywords: update_option trim
----------------------------+-----------------------------------------------
When using wordpress option function "update_option" and the value of the
option is a string containing trailing spaces (wether in front or at the
end), these spaces will be removed. This can destroy the option value
since spaces are chars like any other chars in a string. The option value
then is saved crippeled into the option system and each time the value is
requested again trailing spaces are missing.
The defect is inside the update_option() function on line 281 in
functions.php. In line 289 the option value type is checked to be a string
and if it is a string, the string value will be trimmed:
{{{
if ( is_string($newvalue) )
$newvalue = trim($newvalue);
}}}
It is totally unclear why this happens, the sourcecode isn't documented in
any way. I applied a diff against the current SVN that removes these two
lines of faulty code.
--
Ticket URL: <http://trac.wordpress.org/ticket/4781>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list