[wp-hackers] What is the logic on stripping slashes on add_post_meta?

Mark Cunningham mark.cunningham at gmail.com
Fri Feb 13 09:06:12 GMT 2009


So it boils down to a "feature" of the function rather than a bug
because fixing it will probably cause too many errors and confusion
for other plugins. At the very least though the function documentation
should be updated to indicate that you need to add extra slashes to
protect your input. I'll go update the codex when I get a chance
today.

Mark

2009/2/12 DD32 <wordpress at dd32.id.au>:
> The logic is as follows:
> Originally, The code which is used for meta, was in theform for
> adding-meta directly from the post screen, It was carried across to
> the API functions.
> WordPress addslashes() to all $_POST data (stupidly IMO), so the raw
> meta handling functions expect the input to be slashed (As they're
> originally just  admin template code).
>
> IMO, add_post_meta should be updated to take a non-slashed input, but
> then, theres backwards compat issues with those which pass a slashed
> input in..
>
> 2009/2/13 Ozh <ozh at planetozh.com>:
>>>(...) when people use my plugin on a
>>>Windows host that uses '\' as directory seperaters. It turns
>>>"C:\folder\subfolder" into "C:foldersubfolder".
>>
>> As a general rule in my plugins I always str_replace('\\', '/') every
>> string that can contain a path, even WP consts and vars such as
>> TEMPLATEPATH. Saves a lot of troubles and always work no matter what OS is
>> running.
>>
>> Ozh
>>
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
http://thedeadone.net
http://lostheroesrpg.com
http://irishgamingwiki.com


More information about the wp-hackers mailing list