Project release nodes and Project issue nodes both contain a nodereference back to their parent project.
If a parent project is deleted, then viewing any release or issue node which referenced that project results in a 'Undefined offset: 0' PHP notice, thrown from within the associated hook_node_view() functions (i.e. project_release_node_view() or project_issue_node_view()).
PHP notices are also thrown from within project_project_get_breadcrumb() and the project_release_version_allowed_values()/dereference_list_allowed_list_values() functions due to the "allowed values" code assuming a valid project is being referenced.
Example notices thrown when a parent/referenced project is deleted:
Notice: Trying to get property of non-object in project_release_node_view() (line 906 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project/release/project_release.module).
Notice: Trying to get property of non-object in project_project_get_breadcrumb() (line 319 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project/project.module).
Notice: Trying to get property of non-object in project_project_get_breadcrumb() (line 320 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project/project.module).
Notice: Trying to get property of non-object in project_project_get_breadcrumb() (line 320 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project/project.module).
Notice: Undefined offset: 0 in dereference_list_allowed_list_values() (line 10 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/dereference_list/dereference_list.module).
Notice: Undefined offset: 0 in project_release_version_allowed_values() (line 1315 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project/release/project_release.module).
Notice: Undefined offset: 0 in project_issue_node_view() (line 736 of /var/www/git-dev.drupal.org/htdocs/sites/all/modules/project_issue/project_issue.module).
Proposed Resolution:
Add defensive code to the listed functions to validate the existence of a valid project node.
Original Report:
Visiting https://git7site.devdrupal.org/node/1085786 throws the following notices:
... notices moved to summary above ...
Based on other issues this release caused (with PIFT), this may be related to a missing Core API term on the release. Edit: unrelated
Comments
Comment #1
jthorson commentedVisiting an issue related to that release throws more notices (in addition to those above).
From https://git7site.devdrupal.org/node/1085778:
Comment #2
jthorson commentedVisiting https://git7site.devdrupal.org/project/usage/1085786, the 'project page' link doesn't actually have a project node id appearing. (In addition to all the php notices above.)
Comment #3
eliza411 commentedI have been using the bad_judgment module to troubleshoot a bug in the BDD test suite where a project node was getting deleted somewhere in the test suite. That's why the project is missing. I hope to get that tracked down by Monday at the absolute latest.
Comment #4
eliza411 commentedFYI - the deletion issue is solved, and bad_judgment should return by Monday after the next db import.
I've also realized I'm working in a space others are using and will be more careful about troubleshooting choices in the future! Apologies.
Comment #5
jthorson commentedDon't sweat it ... I jumped to a conclusion based on having discovered a previous issue associated with Bad Judgement (which also existed on D6 prod); and figured this had to be related.
Comment #6
dwwIs there any actionable bug fix we can do in here? Should anything be more defensively coded to handle cases where projects are deleted? If so, let's move this back to active (and perhaps tag for 7.1), otherwise, let's call this "works as designed" and a support request. It's not totally clear based on the discussion above if the conditions leading to the notices are impossible via normal use of the site or not.
Thanks!
-Derek
Comment #7
jthorson commentedAs long as releases and issues are deleted when a project is deleted, I think we should be okay for Drupal.org D7 ... but as the if (!empty($node->field_project)) checks are pretty trivial, I don't think it hurts to throw them in. I know we've encountered a number of spots where we've had to do the same for deleted files.
Comment #8
dwwSo what's the thing that actually caused the problem? A project node was deleted and the corresponding releases (and perhaps issues?) were not? Honestly, seems wrong to delete the issues when a project is deleted, but probably requires more thought. Can someone update the title and perhaps summary with a better description of what went wrong and what we expect should happen instead?
Thanks!
-Derek
Comment #8.0
jthorson commentedUpdated issue summary.
Comment #9
jthorson commentedComment #10
drummSpecifically, some of the BDD cleanup was sometimes deleting actual projects, and is now fixed.
We rarely delete projects on Drupal.org, so it isn't in scope for the upgrade.
Comment #11
dwwCool, all sounds good. Agreed this is out of scope for the D7 launch, but should probably be fixed (especially if we're *not* deleting all issues and releases for a project when the project itself is deleted).
Comment #11.0
dwwUpdated issue summary.
Comment #13
drumm