Problem/Motivation
The conflict module is throwing a fatal error when the workspace activation form is processed. The error occurs because conflict_prepare_entity_form() attempts to call getFormDisplay() on Drupal\workspaces\Form\WorkspaceActivateForm, which doesn't implement ContentEntityFormInterface and therefore doesn't have this method.
The code at line 177-179 includes an instanceof check to prevent this scenario, but the error is still occurring, suggesting either:
- The check is not working as expected in certain conditions
- There's a caching issue that causes older code to execute
- The line numbers in the error trace don't match the actual execution path
Error message:
Error: Call to undefined method Drupal\workspaces\Form\WorkspaceActivateForm::getFormDisplay() in conflict_prepare_entity_form() (line 177 of modules/contrib/conflict/conflict.module)
Steps to reproduce
- Install and enable the conflict module (version 3.0.0-beta2)
- Install and enable the workspaces module
- Navigate to the workspace activation form (typically at
/admin/content/workspace/[workspace_id]/activate) - Observe the fatal error
Proposed resolution
Verify that the instanceof check is functioning correctly and covers all edge cases. Possible solutions:
- Add early return in hook_form_alter: Check if the form object implements
ContentEntityFormInterfacebefore callingconflict_prepare_entity_form() - Strengthen the check: Ensure the
instanceofcheck on line 178 is properly evaluated before thegetFormDisplay()call - Add method_exists check: Use
method_exists()as an additional safety check before callinggetFormDisplay() - Clear documentation: Document that cache clearing is required after updating the module
Remaining tasks
- Confirm the bug with maintainers
- Identify the root cause (why the instanceof check isn't preventing the call)
- Develop and test a patch
- Review and commit the fix
- Update documentation if cache-related
User interface changes
None. This fix prevents a fatal error but doesn't change any user-facing interfaces.
API changes
None. The fix should maintain backward compatibility while preventing the error.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | conflict-3565623-1.patch | 929 bytes | bala_28 |
Comments
Comment #2
bala_28 commentedI have added a patch here.