Support » Plugin: IdeaPush » Undefined offset: 1 in 2 cases

  • Resolved dreamermates

    (@dreamermates)


    We are using the free version of the ideapush plugin.
    We haven’t changed the plugin a lot.
    We are getting 2 errors around “undefined offset: 1” in the debug.log of different homepages.

    Error message 1)
    PHP Notice: Undefined offset: 1 in /www/htdocs/{…}/wp-content/plugins/ideapush/inc/functions/single-idea.php on line 208

    Error message 2)
    PHP Notice: Undefined offset: 1 in /www/htdocs/{…}/wp-content/plugins/ideapush/inc/shortcode/idea-list-items.php on line 43

    Please support/provide a fix, many thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @dreamermates,

    I believe this is an initialisation error and doesn’t repeat. What I am saying is, if you save the plugin settings, I believe the issue won’t occur again.

    With the second issue, this is because you have changed the plugin. You shouldn’t change the plugin.

    Thanks,

    Thread Starter dreamermates

    (@dreamermates)

    Hi team/plugin author,

    Well, that was a quick “resolved”, but it is not resolved at all, sorry.

    ad 1) We have re-installed the plugin, the problem is still existing.
    ad 2) We haven’t changed the plugin at all.

    We’re also not the only persons facing such issues.
    We like your plugin and want to use it further, but therefore we need a stable mature version. Please take a deeper look as the plugin author and provide some more detailed information how to fix this issue or provide a bug fix in a newer version.

    Many thanks in advance!

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @dreamermates,

    You are the only person who has reported this issue, as I am the only developer I am able to notice very easily when there are patterns emerging in requests and there is no pattern here, you are the only one and as I will explain, that is for a good reason. With both these issues someone is purposely trying to get the pro version of the plugin working with the free version of the plugin. That is, you (or someone) have tried to change the code. I say this because the lines you referenced only executes on the pro version, so how could this be an error for you if you are only using the free version? Because you or someone on your site has tried to use the pro version of the plugin via the free plugin which won’t work and will cause errors just like you have shown.

    The 1st error you mentioned, the raw code looks like this:

    if($ideapush_is_pro == "YES"){
                $individual_custom_fields = explode('||',$customFields);
    
                foreach($individual_custom_fields as $customField){
                    $further_custom_field_info = explode('|',$customField);
                    $field_type = $further_custom_field_info[0];
                    $field_name = $further_custom_field_info[1];
                    //i dont think we need to get any further info for now
                    $custom_field_array[$field_name] = $field_type;
                }
            }

    The 2nd error you mentioned, the raw code looks like this:

    if($ideapush_is_pro == "YES"){
                $individual_custom_fields = explode('||',$customFields);
    
                foreach($individual_custom_fields as $customField){
                    $further_custom_field_info = explode('|',$customField);
                    $field_type = $further_custom_field_info[0];
                    $field_name = $further_custom_field_info[1];
                    //i dont think we need to get any further info for now
                    $custom_field_array[$field_name] = $field_type;
                }
            }

    With the error lines you mentioned being in the middle of these 2 code blocks. So how could those lines be executing if $ideapush_is_pro should be no for you. The only way to make $ideapush_is_pro be yes is if you are using the pro version of the plugin or you have made changes to the code which as mentioned won’t work.

    So you need to use the plugin unmodified and remove any customisation you have done anywhere which is trying to change the value of the variable $ideapush_is_pro.

    Thread Starter dreamermates

    (@dreamermates)

    Hi,
    We really don’t know where your’re assumptions are coming from.
    We’re using the latest unchanged free version 8.7 of ideapush.
    Just to be sure, I personally was newly installing this latest plugin on another url.
    The code is the same!

    In Line 208 of single-idea.php,
    We have the code

    205 foreach($individual_custom_fields as $customField){
     206           $further_custom_field_info = explode('|',$customField);
     207           $field_type = $further_custom_field_info[0];
     208           $field_name = $further_custom_field_info[1];
     209           //i dont think we need to get any further info for now
     210           $custom_field_array[$field_name] = $field_type;
    }

    Line 208 is causing the issue because an offset [1] is not defined.

    The line
    if($ideapush_is_pro == "YES"){
    can only be found >90 lines later.
    302 if($ideapush_is_pro == "YES" && isset($options['idea_push_show_custom_fields'])){

    Same for the 2nd issue.
    The first time, “ideapush_is_pro” is used, is in line 368,
    but we have an issue in line 43 !

    Code:

    40 foreach($individual_custom_fields as $customField){
     41         $further_custom_field_info = explode('|',$customField);
     42         $field_type = $further_custom_field_info[0];
     43         $field_name = $further_custom_field_info[1];
     44         //i dont think we need to get any further info for now
     45         $custom_field_array[$field_name] = $field_type;
     46       }

    as part of the function
    idea_push_list_items($boardId,$order,$status,$tag,$customFieldFilter){

    Regarding your third assumption, that no one else is raising this issues, see e. g.
    https://wordpress.org/support/topic/unknown-offeset-1-in-idea-list-posts-arent-displaying/
    You’re writing there that you can only offer limited support and suggesting to upgrade to the pro version. Well.

    We really don’t want to give you a hard time. We like your plugin.
    We’ve tried our best to make our problem transparent and convincing you that we haven’t changed or hacked the code at all !
    Please check your assumptions, again.
    Whatever you need, we can provide.
    Many thanks in advance!

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi @dreamermates,

    Sorry it looks like there was an issue with the releases not pushing to wordpress.org. The code I was looking at was different to what you provided. I have released the latest version on WordPress.org and this will fix your issue.

    Thanks,

    Thread Starter dreamermates

    (@dreamermates)

    We appreciate that.
    Many thanks! 🙂

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    No worries, thanks for your patience and sorry for the miss-understanding.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Undefined offset: 1 in 2 cases’ is closed to new replies.