#9797 closed defect (bug) (fixed)
Widget will not be shown in case of its id includes upper characters
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Widgets | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Pre-requisite:
A widget with its id/id_base includes at least one upper character
Repro Steps:
- Access the back-end page 'Appearance->Widget'
- Drag the widget to a sidebar
- Simply refresh the page
Expected Results:
The widget is shown on that sidebar
Actual Results:
The widget isn't shown on that sidebar
Cause:
Before a widget is registered ,the field 'id' is lowered, say:
-- line 557,function wp_register_sidebar_widget,file widgets.php--- $id = strtolower($id);
But 'id' stored in new WP_Widget class is not lowered:
-- line 90, function __construct, file widgets.php----------------- $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : $id_base;
I gathered from these that why the widget isn't shown is because no widgets with such an id(has some upper characters) found in the registered widgets(all ids are lowered), am i right?
P.S.
It tooks me several hours on this issue, i reviewed my widget codes again and again, every time, couldn't found any fault.I were almost mad before i caught the damned issue. Now, it's yours.
Attachments (2)
Note: See
TracTickets for help on using
tickets.
either of the above two approaches should work. but the second one might be preferred, if the strtolower() was anything useful.