Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined array key error relating to relationship field - EE 7.4.1 #4079

Closed
jcogs-design opened this issue Feb 23, 2024 · 3 comments · Fixed by #4080
Closed

Undefined array key error relating to relationship field - EE 7.4.1 #4079

jcogs-design opened this issue Feb 23, 2024 · 3 comments · Fixed by #4080

Comments

@jcogs-design
Copy link
Contributor

Description of the problem
Getting a block of warnings errors on multiple pages on a site newly updated from EE4 to EE7.4.1
Site is running php 8.0.
Warnings appear to relate to a missing index being accessed by the entry method in Parser.php. Am guessing the remaining warnings are cascaded from this issue. Have done limited poking around and a value is passed as $id in this line (39) but the array $this->_entries does not contain a key with this value.

return $this->_entries[$id];

Error Messages


Warning
Undefined array key 27

ee/legacy/libraries/relationship_parser/Parser.php, line 39

    Severity: E_WARNING

Warning
Trying to access array offset on value of type null

ee/legacy/libraries/relationship_parser/Parser.php, line 664

    Severity: E_WARNING

Warning
Undefined array key 27

ee/legacy/libraries/relationship_parser/Parser.php, line 39

    Severity: E_WARNING

Warning
Trying to access array offset on value of type null

ee/legacy/libraries/relationship_parser/Parser.php, line 424

    Severity: E_WARNING

Warning
Trying to access array offset on value of type null

ee/legacy/libraries/relationship_parser/Parser.php, line 430

    Severity: E_WARNING

Warning
Trying to access array offset on value of type null

ee/legacy/libraries/relationship_parser/Parser.php, line 468

    Severity: E_WARNING

Screenshots / Videos / Template Code
image

Environment Details:

  • Version: 7.4.1
  • PHP Version 8.0
@intoeetive
Copy link
Contributor

@jcogs-design this appears to be caused by broken database. The entry_id 27 was removed from exp_channel_titles but the orphan record remains in exp_relationship table. You should be able to fix this site by removing that record

This (orphan record) does not happen when you delete entry in EE7, however the error should not show up - will work on a fix.

@intoeetive
Copy link
Contributor

... or you can use the fix #4080

although keeping your database clean of orphan records should always be a nice idea

@jcogs-design
Copy link
Contributor Author

Not a site I built so don't know back-story behind missing entries, but agree about trying to keep db clean.
In interim can confirm fix does the job nicely also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants