Bug #23409 Bug Fixed

PHP Notice when using relationship + file tag pair

Version: 4.0.5 Reporter: James Catt

This isn’t a huge issue as the tag output is still working as expected, and it only seems to happen with a specific channel/field (so I can’t rule out that it’s something wonky with my site), but I’d like to get to the bottom of it if possible.

Here’s my template:

{exp:channel:entries channel="my_channel"}
        
  {my_relationship_field}
                            
    {my_relationship_field:my_file_field}

      {!-- some code here, but the error still displays even if this is empty --}

    {/my_relationship_field:my_file_field}

  {/my_relationship_field}
        
{/exp:channel:entries}

As I mentioned, the output from the template is correct, but I’m getting the following PHP Error:

Notice
Undefined index: field_id_21
ee/legacy/libraries/channel_entries_parser/components/Custom_field_pair.php, line 138

Severity: E_NOTICE

field_id_21 == my_file_field (I get the same error repeated for every file field referenced)

The strange thing is that I have the same pattern in another template (with a different parent channel + relationship field, but the same child channel + file field), but I’m not getting the same error message.

I’ve looked at the debugging output but I’m not seeing any obvious issues.

  • PS: I don’t get this error under 3.5.14 – it started happening after upgrading to 4.0.5

    James Catt
    11th January, 2018 at 1:40pm
  • Sorry for the trouble, James. As far as I can tell, this has nothing to do with it being a File field, but more trying to access a field that doesn’t exist in the channel whose entry you’re displaying. That’s the only way I can reproduce, anyway. Does that sound right, given the contents of this relationship field? Either way, I’ll get in a fix for the error I’m seeing, which will probably fix it for you, too.

    Kevin Cupp
    11th January, 2018 at 4:38pm
  • Thanks for looking into it.

    The field doesn’t exist in the parent channel (although the same is true in the other template that doesn’t get the error). The field definitely exists in the child channel, and is populated for all the entries selected in the relationship field.

    I’ve also found that the error is occurring on another template that has the same parent channel but a different relationship field (same child channel though). So it would seem like it has something to do with either that specific parent channel, or the specific parent entry (the parent channel only has one entry with multiple relationship fields—we use it for selecting featured content entries to display on the homepage and a few other places).

    In any case, hopefully your fix will take care of it. Thanks!

    James Catt
    12th January, 2018 at 9:37am
  • Just posting to let you know that the fix in 4.0.6 did get rid of the PHP notices for me. Thanks!

    James Catt
    17th January, 2018 at 9:55am

You must be signed in to comment on a bug report.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases