WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
Undefined index.., Undefined offset.. warnings with WP_DEBUG (10 posts)

  1. Ov3rfly
    Member
    Posted 1 year ago #

    Here my contribution to your helpful plugin.

    With define('WP_DEBUG', true); in wp-config.php some PHP warnings can be observed in a WordPress 3.4.2 and 3.5.1 admin backend, especially in combination with WPML plugin and its language switcher widget.

    1. Warning on top of page /wp-admin/widgets.php:

    Notice: Undefined index: icl_lang_sel_widget in ..wp-content/plugins/widget-logic/widget_logic.php on line 116

    Line 116, old:

    if (!$wp_registered_widget_controls[$id])

    Line 116, quick fix:

    if (!isset($wp_registered_widget_controls[$id]))

    2. Warning when clicking the dropdown "open" button at WPML language switcher widget:

    Notice: Undefined offset: 0 in ..wp-content/plugins/widget-logic/widget_logic.php on line 233

    Line 233, old:

    $number=$params[0]['number'];
    if ($number==-1) {$number="__i__"; $value="";}
    $id_disp=$id;

    Line 233, quick fix:

    if (!empty($params)) {
    	$number=$params[0]['number'];
    	if ($number==-1) {$number="__i__"; $value="";}
    }
    $id_disp=$id;

    Warnings like these are pretty annoying during development where WP_DEBUG is required as they also break unrelated ajax-responses within admin-backend.

    Note: WPML plugin seems to be available for free for plugin-authors with compatibility issues, more here: http://wpml.org/documentation/theme-compatibility/go-global-program/

    http://wordpress.org/extend/plugins/widget-logic/

  2. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    thanks! i'll pop those in the dev version asap.

  3. Ov3rfly
    Member
    Posted 1 year ago #

    Thanks for quick reponse.

    Maybe there are also other undefined variables, did not check the whole plugin...

  4. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    i tried another approach with line 233, which is in the DEV now. give it a go, let me know.

  5. Ov3rfly
    Member
    Posted 1 year ago #

    The current DEV causes a similar warning because if $params is empty then variable $number is not defined/set before the comparison: if ($number==-1) ..

    Notice: Undefined variable: number in ..wp-content/plugins/widget-logic/widget_logic.php on line 234
  6. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    sorry, of course, must get round to a DEV install with WP_DEBUG turned on myself. hang on…

  7. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    that should do it.

  8. Ov3rfly
    Member
    Posted 1 year ago #

    Now the current DEV fixes the problem. Thanks for quick response.

  9. andamira
    Member
    Posted 4 months ago #

    Do you plan to update the main version from the trunk? I found the same error and I could apply the fix manually but since the bug was solved 10 months ago...

  10. alanft
    Member
    Plugin Author

    Posted 4 months ago #

    ok. will do. and update 'works with too' why not

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags