<p dir="auto">Hi,<br>
There's a problem when i want to remove directories retrieved by finder instance. The problem is that the directory is successfully deleted but there was an exception generated after that:</p>
<p dir="auto">RecursiveDirectoryIterator::__construct(/home/fattouch/NordnetProjects/diamant/app/../web/data/tmp/in/email/attachments): failed to open dir: No such file or directory</p>
<p dir="auto">When you access the \Symfony\Component\Serializer\Normalizer\AbstractNormalizer::getAllowedAttributes method with <code class="notranslate">$attributesAsString = false</code>, you run into the following issue:</p>
<blockquote>
<p dir="auto">Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Catchable Fatal Error: Object of class Symfony\Component\Serializer\Mapping\AttributeMetadata could not be converted to string' in <a href="https://github.com/symfony/serializer/blob/master/Normalizer/AbstractNormalizer.php#L207">.../Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php:207</a></p>
</blockquote>
<p dir="auto">This is due to the fact that <strong>array_unique</strong> can only be used with arrays of scalars. As it includes instances of <code class="notranslate">AttributeMetadataInterface</code>, we get the exception.</p>
<p dir="auto">Why there is no test case throwing this error is due to fact that this method never gets called with <code class="notranslate">$attributesAsString = false</code>. So I would propose to set the default value parameter for the parameter <code class="notranslate">$attributesAsString</code> to <code class="notranslate">true</code> or even remove the possibility to return <code class="notranslate">AttributeMetadataInterface[]</code>. (Because this error occurs, we know that nobody could have ever used this feature.)</p>
<p dir="auto">I could fix this by myself by replacing the line of code with:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        if ($attributesAsString) {
            $allowedAttributes = array_unique($allowedAttributes);
        }
        return $allowedAttributes;"><pre class="notranslate">        <span class="pl-k">if</span> (<span class="pl-s1"><span class="pl-c1">$</span>attributesAsString</span>) {
            <span class="pl-s1"><span class="pl-c1">$</span>allowedAttributes</span> = array_unique(<span class="pl-s1"><span class="pl-c1">$</span>allowedAttributes</span>);
        }
        <span class="pl-k">return</span> <span class="pl-s1"><span class="pl-c1">$</span>allowedAttributes</span>;</pre></div>
<p dir="auto">Kind regards,<br>
Konstantin</p>