Entity form: build entity - Incompatible with address field?
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3548576. --> Reported by: [sunlix](https://www.drupal.org/user/1515828) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I have a content type with an address field on it.<br> Building an entity during a "Validate form" event throws this error.</p> <p>It may be an error in address but because it is triggered via an ECA model I want to preclude that the Action is missing something.</p> <pre>TypeError: end(): Argument #1 ($array) must be of type array, null given in end() (line 403 of modules/contrib/address/src/Element/Address.php).<br><br>Drupal\address\Element\Address::clearValues()<br>call_user_func_array() (Line: 1085)<br>Drupal\Core\Form\FormBuilder-&gt;doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder-&gt;doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder-&gt;doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder-&gt;doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder-&gt;doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;doBuildForm() (Line: 571)<br>Drupal\Core\Form\FormBuilder-&gt;processForm() (Line: 144)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;processForm() (Line: 172)<br>Drupal\eca_form\Plugin\Action\FormBuildEntity-&gt;execute() (Line: 107)<br>Drupal\eca\Entity\Objects\EcaAction-&gt;execute() (Line: 298)<br>Drupal\eca\Processor-&gt;executeSuccessors() (Line: 222)<br>Drupal\eca\Processor-&gt;execute() (Line: 69)<br>Drupal\eca\EventSubscriber\DynamicSubscriber-&gt;onEvent() (Line: 206)<br>Symfony\Component\EventDispatcher\EventDispatcher-&gt;callListeners() (Line: 56)<br>Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch() (Line: 66)<br>Drupal\eca\Event\TriggerEvent-&gt;dispatchFromPlugin() (Line: 253)<br>Drupal\eca_form\Hook\FormHooks::validate()<br>call_user_func_array() (Line: 82)<br>Drupal\Core\Form\FormValidator-&gt;executeValidateHandlers() (Line: 275)<br>Drupal\Core\Form\FormValidator-&gt;doValidateForm() (Line: 118)<br>Drupal\Core\Form\FormValidator-&gt;validateForm() (Line: 69)<br>Drupal\autosave_form\Form\AutosaveFormValidator-&gt;validateForm() (Line: 585)<br>Drupal\Core\Form\FormBuilder-&gt;processForm() (Line: 144)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;processForm() (Line: 321)<br>Drupal\Core\Form\FormBuilder-&gt;buildForm() (Line: 97)<br>Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;buildForm() (Line: 73)<br>Drupal\Core\Controller\FormController-&gt;getContentResult()<br>call_user_func_array() (Line: 123)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 627)<br>Drupal\Core\Render\Renderer-&gt;executeInRenderContext() (Line: 121)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext() (Line: 97)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)<br>Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw() (Line: 76)<br>Symfony\Component\HttpKernel\HttpKernel-&gt;handle() (Line: 53)<br>Drupal\Core\StackMiddleware\Session-&gt;handle() (Line: 48)<br>Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle() (Line: 28)<br>Drupal\Core\StackMiddleware\ContentLength-&gt;handle() (Line: 116)<br>Drupal\page_cache\StackMiddleware\PageCache-&gt;pass() (Line: 90)<br>Drupal\page_cache\StackMiddleware\PageCache-&gt;handle() (Line: 48)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle() (Line: 51)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle() (Line: 53)<br>Drupal\Core\StackMiddleware\AjaxPageState-&gt;handle() (Line: 51)<br>Drupal\Core\StackMiddleware\StackedHttpKernel-&gt;handle() (Line: 715)<br>Drupal\Core\DrupalKernel-&gt;handle() (Line: 19)</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Create a content type with an address field on it (<a href="https://www.drupal.org/project/address">https://www.drupal.org/project/address</a>)<br> Create a model with "Validate form" event and chain just a "Entity form: build entity" action.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue