#9797 closed defect (bug) (fixed)
Widget will not be shown in case of its id includes upper characters
| Reported by: | kamiyeye | Owned by: | azaozz |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Widgets | Version: | 2.8 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
either of the above two approaches should work. but the second one might be preferred, if the strtolower() was anything useful.