Fatal error when disabling a model that hasn't been saved as

Created on 2 July 2025, 5 days ago

Problem/Motivation

If you try to disable a module that has yet to be accessed/saved, for example one created by a recipe, you get a fatal error. The workaround is to edit the model first, then you see the success message that it has been saved, and then you can disable it.

Steps to reproduce

  1. Install Drupal CMS
  2. Go to the ECA page
  3. Try to disable a model, see fatal error
    ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty in DOMDocument->loadXML() (line 32 of /Users/pamelabarone/Documents/drupal/vendor/mtownsend/xml-to-array/src/XmlToArray.php).
    
  4. Edit the model, see message that it was saved
  5. Try to disable again, see that it works

Proposed resolution

Not sure -- this isn't necessarily a critical issue, but ideally the exception can be handled better.

Full stacktrace:

Mtownsend\XmlToArray\XmlToArray::xmlStringToArray('') (Line: 22)
Mtownsend\XmlToArray\XmlToArray::convert('') (Line: 88)
Drupal\eca_modeller_bpmn\ModellerBpmnBase->prepareForUpdate('') (Line: 283)
Drupal\eca_modeller_bpmn\ModellerBpmnBase->disable() (Line: 151)
Drupal\eca_ui\Controller\EcaController->disable('front_page_redirect_hotfix')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 622)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 715)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
require('/Users/pamelabarone/Documents/drupal/web/index.php') (Line: 71)
🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇦🇺Australia pameeela

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pameeela
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks @pameeela for reporting this with all the details. Fortunately, this is only for ECA 2.x, but no longer for the upcoming new version 3.

    Not even sure it's a bug, it's because of inconsistent ECA config entities, as it turns out. Back in January, we provided a mechanism to get rid of that raw XML data that everybody was so afraid of. But we left the property modeller: bpmn_io in all the config entities. That should have been changed to modeller: fallback to indicate that we don't have XML data for bpmn_io available.

    It seems, it's too late to fix that now, so we should probably add a mechanism to automatically fall back to that rudimentary modeller if no XML data is available. I'll post an MR in a second for you to try.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is ready for review, but it requires also the MR for bpmn_io from the linked issue.

  • Pipeline finished with Failed
    5 days ago
    Total: 561s
    #537464
  • 🇦🇺Australia pameeela

    Thanks @jurgenhaas that does indeed fix the issue, but seems to cause a new one. With this change, the 'Edit' CTA becomes 'Edit with BNPM.io' in some cases (did not look into why, but probably obvious to you) and clicking that results in:

    Error: Call to undefined method Drupal\eca\Plugin\ECA\Modeller\Fallback::prepareEmptyModelData() in Drupal\bpmn_io\Services\Converter\Converter->convert() (line 76 of modules/contrib/bpmn_io/src/Services/Converter/Converter.php).
    

    So, wondering if this should just be "won't fix" since it's in the older branch anyway and is an edge case.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    The label change is intentional and the other issue requires the mr from the related issue in bpmn_io as i mentioned in my previous comment.

  • 🇦🇺Australia pameeela

    Whoops! I read that comment then immediately forgot about it. Of course, it works with the other change.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thank you so much for testing, will tag patch releases before the end of the week.

  • Pipeline finished with Failed
    4 days ago
    Total: 479s
    #537775
  • Pipeline finished with Success
    4 days ago
    Total: 480s
    #537782
  • Pipeline finished with Skipped
    4 days ago
    #537789
    • jurgenhaas committed 3b4b3ad7 on 2.1.x
      Issue #3533720 by jurgenhaas, pameeela: Fatal error when disabling a...
  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024