WordPress.org

Ready to get started?Download WordPress

Forums

Cookie Opt In
[resolved] Bugs+fixes] Lots of PHP error notices (4 posts)

  1. jrf
    Member
    Posted 1 year ago #

    Hiya,

    Please fix your plugin to properly deal with variables, getting some twenty-odd notices on activation, viewing the options page and viewing any front-end webpage. This does not encourage confidence in your plugin.

    Also, please remove your own custom css from the admin-site of things, the admin page is now pretty unusable - being double the width of the screen and having different font sizes which are not in line with the rest of the admin pages.

    File wp-cookie-opt-in.php

    Line 46:

    if (in_array($_GET['page'], array('cookie-opt-in', 'cookie-opt-in-admin', 'cookie-opt-in-settings', 'cookie-opt-in-dev', 'cookie-opt-in-actions'))) {

    replace with:

    if ( isset( $_GET['page']) && in_array($_GET['page'], array('cookie-opt-in', 'cookie-opt-in-admin', 'cookie-opt-in-settings', 'cookie-opt-in-dev', 'cookie-opt-in-actions'))) {

    Line 284:

    if (!is_array($settings['un_action'][$key])) $settings['un_action'][$key] = array();

    replace with:

    if (!isset($settings['un_action'][$key]) || !is_array($settings['un_action'][$key])) $settings['un_action'][$key] = array();

    Line 257-263:

    public static function visitor_accepts($type) {
        $settings = self::settings();
        $cookie = $_COOKIE[ $settings['preference_cookie_name'] ];
        $reg = '/'. substr($type, 0, 1) . '([01])' .'/';
        preg_match($reg, $cookie, $match);
        return $match[1] == '1';
      }

    *** Not sure what to do about these ones without studying the plugin in depth (which I'm not looking to do). The errors are:
    Notice: Undefined index: ClearsiteCookieLawObidingCookiePreferencesCookie in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 259
    Notice: Undefined offset: 1 in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 262

    Line 291-293:

    list($action, $function, $priority) = explode(':', trim($value));
              list($class,$method) = explode(',', $function);
              list($_idx, $idx) = explode('IDX#', $function);

    *** Again, not sure what to do with this one. It causes numerous errors along the lines of:
    Notice: Undefined offset: 2 in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 291
    Notice: Undefined offset: 1 in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 293

    Even more error-notices:
    Notice: Undefined index: cookies_to_destroy in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 106
    Warning: Invalid argument supplied for foreach() in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 106
    Notice: Undefined index: cookies_to_destroy in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/wp_cookie_opt_in.php on line 144

    File /templates/admin_page.php

    Line 162:

    <input type="text" name="settings[<?php print $j = str_replace('site_has_', 'more_info_', $i); ?>]" value="<?php print esc_attr($settings[$j]); ?>" />

    replace with:

    <input type="text" name="settings[<?php print $j = str_replace('site_has_', 'more_info_', $i); ?>]" value="<?php print ( isset( $settings[$j] ) ? esc_attr($settings[$j]) : '' ); ?>" />

    Line 172:

    <textarea name="settings[un_action][<?php print $j = $_section ?>]"><?php print implode("\n", (array)$settings['un_action'][$j]); ?></textarea>

    replace with:

    <textarea name="settings[un_action][<?php print $j = $_section ?>]"><?php print ( isset( $settings['un_action'][$j] ) ? implode("\n", (array)$settings['un_action'][$j]) : '' ); ?></textarea>

    Line 175:

    $b = coi_urlencode(sprintf(__("For section: %s", 'cookie_opt_in'), $section) .";\n\n". implode("\n", (array)$settings['un_action'][$_section]) . "\n\n". get_bloginfo('url'));

    replace with:

    $b = coi_urlencode(sprintf(__("For section: %s", 'cookie_opt_in'), $section) .";\n\n". ( isset( $settings['un_action'][$_section] ) ? implode("\n", (array)$settings['un_action'][$_section]) : '' ) . "\n\n". get_bloginfo('url'));

    Line 182:

    </tr><?php if ($settings['un_action_unchangeable'][$_section]) { ?>

    replace with:

    </tr><?php if ( isset($settings['un_action_unchangeable'][$_section]) && $settings['un_action_unchangeable'][$_section]) { ?>

    Line 189-190:

    <td><code><?php print implode('</code><br /><code>', (array)$slice[0]); ?></code></td>
              <td><code><?php print implode('</code><br /><code>', (array)$slice[1]); ?></code></td>

    *** Not sure what to do with this one. It causes numerous errors along the lines of:
    Notice: Undefined offset: 1 in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/templates/admin_page.php on line 189
    Notice: Undefined offset: 2 in /hsphere/local/home/funale/test.verlaatverdriet.nu/wp-content/plugins/cookie-opt-in/templates/admin_page.php on line 190

    Hope this helps. Good luck!

    Smile,
    Juliette

    http://wordpress.org/extend/plugins/cookie-opt-in/

  2. Clearsite
    Member
    Plugin Author

    Posted 1 year ago #

    I appreciate your concern about the notices regarding undefined variables/offsets. Please note that practically all PHP/Apache servers have the ERROR_REPORTING value set to ignore notices. An example would be:

    error_reporting(E_ALL ^ E_NOTICE);

    Again, I do appreciate your feedback, I will look into it.

  3. Clearsite
    Member
    Plugin Author

    Posted 1 year ago #

    Version 1.2.1 no longer displays E_NOTICE messages.
    Thanks again.

  4. jrf
    Member
    Posted 1 year ago #

    Even though E_NOTICE often do not get displayed, this doesn't mean that they don't matter...
    Glad to hear you fixed them.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic