[wp-trac] [WordPress Trac] #12133: get_field_id() and get_field_name() break when passed a name in array format
WordPress Trac
noreply at wordpress.org
Mon Jan 21 22:21:17 UTC 2013
#12133: get_field_id() and get_field_name() break when passed a name in array
format
-------------------------+-----------------------------
Reporter: johnbillion | Owner: azaozz
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Widgets | Version: 2.9.1
Severity: minor | Resolution:
Keywords: needs-patch |
-------------------------+-----------------------------
Comment (by scribu):
1) In get_field_id():
{{{
str_replace(array('][', '[', ']', ' '), '-', trim($field_name, ' []')
}}}
can be simplified to this:
{{{
strtr('[] ', '-', $field_name)
}}}
or maybe even
{{{
sanitize_title_with_dashes($field_name)
}}}
2) I don't think the logic in get_field_name() is correct. If $field_name
is 'foo[bar]', you'll end up with nested brackets: `[$this->id][foo[bar]]`
which will not produce correct values in $_POST.
3) Tabs, not spaces http://make.wordpress.org/core/handbook/coding-
standards/#indentation
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12133#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list