Address results not checked for errors - page produces: Warning: Undefined array key "Collection"
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3529185. --> Reported by: [joachim](https://www.drupal.org/user/107701) Related to !7 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I'm getting a lot of errors and no results for the page for a single address.</p> <p>The errors start with:</p> <pre>Warning: Undefined array key "Collection" in Drupal\localgov_waste_collection_whitespace_provider\Plugin\DataProvider\WhitespaceDataProvider-&gt;getCollections() (line 282 of /var/www/html/repos/localgov_waste_collection/modules/localgov_waste_collection_whitespace_provider/src/Plugin/DataProvider/WhitespaceDataProvider.php).</pre><p>The code in question is this:</p> <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $json = json_encode($collectionsXml);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $monthCollections = json_decode($json, TRUE);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($monthCollections["Collection"] as $collection) {</pre><p>The problem is that the XML body being loaded up doesn't have any collections, but this error message instead:</p> <pre>&nbsp; &lt;s:Body&gt;<br>&nbsp;&nbsp;&nbsp; &lt;GetCollectionByUprnAndDateResponse xmlns="http://webservices.whitespacews.com/"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;GetCollectionByUprnAndDateResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CodeDescription&gt;No results returned&lt;/CodeDescription&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ErrorCode&gt;6&lt;/ErrorCode&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ErrorDescription&gt;No results returned&lt;/ErrorDescription&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;SuccessFlag&gt;false&lt;/SuccessFlag&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Collections i:nil="true"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/GetCollectionByUprnAndDateResult&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/GetCollectionByUprnAndDateResponse&gt;<br>&nbsp; &lt;/s:Body&gt;</pre><p>I *should* be getting results for the address I am using. </p> <p>Could it be that my site's account with Whitespace is doing things differently?</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <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> > Related issue: [Issue #3529150](https://www.drupal.org/node/3529150)
issue