All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Saving channel entry with Relationship inside a Grid field in default language shows “Undefined index: grid_row_id”

Status Resolved
Add-on / Version Publisher 3.9.0
Severity
EE Version 6.4.4

Hop Studios

Jan 27, 2023

Hey Brian,

With a basic and fresh installation of Publisher 3.9.0 I am encountering an issue with saving an entry in the default language.

I have created a video describing the issue and showing how it is triggered.

The error that shows up when saving the entry in default language is
Undefined index: grid_row_id
ee/ExpressionEngine/Addons/relationship/ft.relationship.php, line 179


I have put the video and HTML save file of the stack trace here:
https://drive.google.com/drive/folders/1e6lSufCLIL3EAMDJrpEKdB6AHX9w-e0P?usp=share_link

If you have a preferred format of the ‘debug_backtrace’ code, please provide and I will replace the debugging code and send you the result.

It would be great if you could help debug this.

Thanks,
Rowan

#1

BoldMinded (Brian)

Hi, Rowan. Sorry I haven’t had a chance to look into this yet. I’ll try to get to it this week though.

#2

BoldMinded (Brian)

I’m looking at ft.relationship.php line 179 in EE6 and EE7, and neither of them have anything about grid_row_id. Line 168 is the first instance of that property name. Have your files been modified at all? Have you tried replicating this with a new clean EE environment?

#3

BoldMinded (Brian)

I noticed in your video that you had 2 grid fields, the first with a Relationship column, then another field which looked like it contained a File field. I replicated that locally in EE 6, and I still can’t reproduce the error.

I think the next step for you would be to try to replicate it in a new/clean EE environment with just Publisher installed. If you can’t replicate it in a new environment then it leads me to believe there is something specific with your current environment that is causing the issue. It could be an add-on conflict, a setting we’re not looking at, or something else going on. The mismatch in the error line number gives me a little concern.

#4

Hop Studios

Hey Brian,

Thanks for the testing & details above. Much appreciated.

I did some more sleuthing today and tried the following:

Created a new channel Added a Grid with all the same columns as the original channel. Got the same error

I added a new grid field and added a relationship column. Did NOT get the error when saving. I added a File column to the Grid. I DID get the error.

I suspect it is an interaction between Grid with BOTH relationship and file columns.

Please review the video and let me know if you can replicate or not.

Here’s the screen recording: https://drive.google.com/file/d/19RfY_ZuxFolXhrmEfcBmpZ4TLrOrSI6g/view?usp=share_link

Thanks, Rowan

#5

Hop Studios

It is worth noting that the same behaviour exists for a File Grid. I tested this using a new File Grid field plus a Relationship column, and get the same error.

Also one further note about the line number the code I added to the ee/ExpressionEngine/Addons/relationship/ft.relationship.php file consisted only of debugging output code.

The error with the exact file from EE 6.4.4 is: Undefined index: grid_row_id ee/ExpressionEngine/Addons/relationship/ft.relationship.php, line 168

Severity: E_NOTICE

#6

BoldMinded (Brian)

What is interesting about the call stack you shared, is that there isn’t as single Publisher function getting called. So based on that info I have no where to start or even look at what might be causing the issue.

Have you tried replicating this without Publisher installed?

#7

Hop Studios

“Have you tried replicating this without Publisher installed?” Yes, the issue does not show up when Publisher is not installed. I would imagine that it has something to do with the session variable save action, which I’m sure you understand way better than I do. From my work on the language importer add-on, I recall that Publisher intercepts save data and uses the after channel entry save to write the grid/relationship data based on what is in the session storage. I’m gapping on the specific terminology etc. but I suspect that has something to do with it.

Were you able to replicate it or did you try?

Rowan

#8

BoldMinded (Brian)

Can you share screenshots of your two Grid field settings so I can accurately replicate them locally?

#9

BoldMinded (Brian)

never mind, I see it in the video.

#10

BoldMinded (Brian)

Ok, I was able to replicate it. I had my PHP notices turned off. For now, the best advice I can give is to change your PHP error settings to hide notices. Based on what is happening and the order of how things are called I’m not sure if there is anything I can do to fix it. I think this is easily fixed though in EE’s core by not assuming those array keys exist and have a value and providing defaults:

line 166-168 of ft.relationship.php could be changed to this and it’ll probably be a better all around solution:

$all_rows_where['grid_col_id'] = $this->settings['col_id'] ?? 0;
            $all_rows_where['grid_field_id'] = $this->settings['grid_field_id'] ?? 0;
            $all_rows_where['grid_row_id'] = $this->settings['grid_row_id'] ?? 0;

I’m going to submit a PR to their Github with this suggestion.

You’re getting the error message…. but I’m betting the grid rows are still saving fine?

#11

Hop Studios

Hey Brian, Thanks so much for this, I’m relieved to know you were able to generate the same warnings.

Great point about the debugging. You are right, setting the $config['debug'] = '0' works to suppress the warnings and the entry does save.

I tested the persistence settings and was a bit confused by this. I noticed that even with persistence settings on for relationships, the Examples grid > Relationship field was not greyed out on the non-default language. I am not sure if this is by design or what, but it seemed like on some previous version of Publisher if Persistence was turned on, the field was blocked for editing.

I recorded a little video for the client showing the successful save action with no error, and the data being saved properly. Great stuff!

https://drive.google.com/file/d/1uYPUPkMzeE53FMB8bHgGDwHi9yx3pOQD/view?usp=share_link

Thanks for submitting the PR for the issue and fix above, thats great.

I appreciate your help with this. I think we have a workable path forward to get the site updated and working as hoped.

Rowan

#12

BoldMinded (Brian)

PR for reference: https://github.com/ExpressionEngine/ExpressionEngine/pull/2823

#13

BoldMinded (Brian)

Regarding the persistence issue, are there any JS errors in your console? In my EE 6 environment viewing non-default language the Relationship field inside of a Grid does have the title overlay screen so it’s not editable.

#14

Hop Studios

Hey Brian, I don’t see any seemingly related JS errors. Here is what I do see: https://i.gyazo.com/ca24f074d75202bdd0ac3a7080bf8310.png

I noticed the class is added, and there is a div.disabled-field object generated, it just is not being shown.

By default here’s what I see: https://i.gyazo.com/1ebb6f5b0002ec12e7abf7ded5512804.jpg Note the ‘display: none’ css property

If I turn off that property, i see the overlay: https://i.gyazo.com/6b66496ebc69b76b28ea430d5c8fe3a9.jpg

I double checked that I had the right CSS loading. I re-copied the publisher themes. I cleared cache. I hard reloaded. Same issue.

let me know if you have any insight into this lil bug.

thanks again rowan

#15

BoldMinded (Brian)

Comment has been marked private.

#16

BoldMinded (Brian)

It looks like they’re approving my PR so I’m going to close this out.

Login to reply