• defaults.php file is not handling the existence of the keys within arrays correctly. I’m getting “Undefined index” errors when saving options and also for URL port checking (port does not always exist!). The port error is also referenced for your plugin here (https://www.ads-software.com/support/topic/error-and-not-working/)

    I’ve posted my patch below so that you can update your plugin.
    ———————————————————-
    diff –git a/wp-content/plugins/eu-cookie-law/defaults.php b/wp-content/plugins/eu-cookie-law/defaults.php
    index 1cb65ee..cb979b0 100644
    — a/wp-content/plugins/eu-cookie-law/defaults.php
    +++ b/wp-content/plugins/eu-cookie-law/defaults.php
    @@ -30,7 +30,7 @@
    $my_options = get_option(‘peadig_eucookie’);
    $conta = count($defaults);
    for($i=0;$i<$conta;$i++){
    – if (!$my_options[$defaults[$i][0]]) {
    + if (!isset($my_options[$defaults[$i][0]])) {
    $my_options[$defaults[$i][0]] = $defaults[$i][1];
    update_option(‘peadig_eucookie’, $my_options);
    }
    @@ -49,7 +49,11 @@
    wp_die( ‘ERROR: Path corrupt for parsing.’ ); // replace this with a better error result

    $sScheme = $asParts[‘scheme’];
    – $nPort = $asParts[‘port’];
    + if (isset($asParts[‘port’])) {
    + $nPort = $asParts[‘port’];
    + } else {
    + $nPort = ”;
    + }
    $sHost = $asParts[‘host’];
    $nPort = 80 == $nPort ? ” : $nPort;
    $nPort = ‘https’ == $sScheme AND 443 == $nPort ? ” : $nPort;

  • The topic ‘Undefined Index handling’ is closed to new replies.