<p dir="auto">Hi,</p>
<p dir="auto">I do not know if this is a bug or a feature... I am still investigating this, but if you have some guidance I would appreciate.</p>
<p dir="auto">For a reason I do not know (yet), sometimes, an empty array is passed to the method <a href="symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php#L46"><code class="notranslate">Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper::mapFormsToData</code></a> (a <code class="notranslate">var_dump</code> gives <code class="notranslate">array (size=0) empty</code>) when nothing is checked by the user (this form is not required).</p>
<p dir="auto">Until <code class="notranslate">2.8.5</code>, everything was great. But from <code class="notranslate">2.8.5</code>, the class <a href="symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php"><code class="notranslate">Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper</code></a> has changed in commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/symfony/symfony/commit/ea5375c7b78ecb71790475935edfe6855c15dc7d/hovercard" href="https://github.com/symfony/symfony/commit/ea5375c7b78ecb71790475935edfe6855c15dc7d"><tt>ea5375c</tt></a>, an and <code class="notranslate">Symfony\Component\Form\Exception\UnexpectedTypeException</code> is thrown.</p>
<p dir="auto">Logically, when I change the method <code class="notranslate">mapFormsToData</code> to allow empty arrays, the method is processed without any error :</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public function mapFormsToData($radios, &amp;$choice)
    { 
       // the condition was if (null !== $choice &amp;&amp; !is_string($choice))
        if (
              null !== $choice &amp;&amp; !is_string($choice)
              AND
              !(is_array($choice) &amp;&amp; count($choice) === 0)
        ) {
                 throw new UnexpectedTypeException($choice, 'null, string or empty array');
        }

        $choice = null;

        // as we have an empty array, this loop is not executed, the $choice remains on `null` and everything is fine...
        foreach ($radios as $radio) {
            if ($radio-&gt;getData()) {
                if ('placeholder' === $radio-&gt;getName()) {
                    return;
                }

                $choice = $radio-&gt;getConfig()-&gt;getOption('value');

                return;
            }
        }
    }"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">mapFormsToData</span>(<span class="pl-s1"><span class="pl-c1">$</span>radios</span>, &amp;<span class="pl-s1"><span class="pl-c1">$</span>choice</span>)
    { 
       <span class="pl-c">// the condition was if (null !== $choice &amp;&amp; !is_string($choice))</span>
        <span class="pl-k">if</span> (
              <span class="pl-c1">null</span> !== <span class="pl-s1"><span class="pl-c1">$</span>choice</span> &amp;&amp; !is_string(<span class="pl-s1"><span class="pl-c1">$</span>choice</span>)
              AND
              !(is_array(<span class="pl-s1"><span class="pl-c1">$</span>choice</span>) &amp;&amp; count(<span class="pl-s1"><span class="pl-c1">$</span>choice</span>) === <span class="pl-c1">0</span>)
        ) {
                 <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-v">UnexpectedTypeException</span>(<span class="pl-s1"><span class="pl-c1">$</span>choice</span>, <span class="pl-s">'null, string or empty array'</span>);
        }

        <span class="pl-s1"><span class="pl-c1">$</span>choice</span> = <span class="pl-c1">null</span>;

        <span class="pl-c">// as we have an empty array, this loop is not executed, the $choice remains on `null` and everything is fine...</span>
        <span class="pl-k">foreach</span> (<span class="pl-s1"><span class="pl-c1">$</span>radios</span> <span class="pl-k">as</span> <span class="pl-s1"><span class="pl-c1">$</span>radio</span>) {
            <span class="pl-k">if</span> (<span class="pl-s1"><span class="pl-c1">$</span>radio</span>-&gt;<span class="pl-en">getData</span>()) {
                <span class="pl-k">if</span> (<span class="pl-s">'placeholder'</span> === <span class="pl-s1"><span class="pl-c1">$</span>radio</span>-&gt;<span class="pl-en">getName</span>()) {
                    <span class="pl-k">return</span>;
                }

                <span class="pl-s1"><span class="pl-c1">$</span>choice</span> = <span class="pl-s1"><span class="pl-c1">$</span>radio</span>-&gt;<span class="pl-en">getConfig</span>()-&gt;<span class="pl-en">getOption</span>(<span class="pl-s">'value'</span>);

                <span class="pl-k">return</span>;
            }
        }
    }</pre></div>
<p dir="auto">I do not know if we have to be so strong in the condition, or if this class should also accept empty array.</p>
<p dir="auto">So, is this a bug or a feature ?</p>
<h3 dir="auto">Some context</h3>
<p dir="auto">As I said before, I do not know why we have an empty array. This array comes from a CustomType which produce a field "Choice with other" (the user may choose amongst different values, or pick another value and fill a text).  This <em>Type</em> may allow multiple choices (<code class="notranslate">'multiple' =&gt; true</code>) or not, and is not required. When <code class="notranslate">multiple</code> is <code class="notranslate">true</code>, we do not encounter problems. When <code class="notranslate">multiple</code> is <code class="notranslate">false</code>, the <code class="notranslate">RadioListMapper</code> is executed and the exception is thrown. This <em>Type</em> is attached to a <em>DataTransformer</em> which transform the values into an array and store that as an array.</p>
<p dir="auto">Some code :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class ChoiceWithOtherType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options) 
    {
        //add an 'other' entry in choices array
        $options['choices']['_other'] = $this-&gt;otherValueLabel;
        //ChoiceWithOther must always be expanded
        $options['expanded'] = true;

        $builder
            -&gt;add('_other', 'text', array('required' =&gt; false))
            -&gt;add('_choices', 'choice', $options)
        ;    
    }
}"><pre class="notranslate"><code class="notranslate">class ChoiceWithOtherType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options) 
    {
        //add an 'other' entry in choices array
        $options['choices']['_other'] = $this-&gt;otherValueLabel;
        //ChoiceWithOther must always be expanded
        $options['expanded'] = true;

        $builder
            -&gt;add('_other', 'text', array('required' =&gt; false))
            -&gt;add('_choices', 'choice', $options)
        ;    
    }
}
</code></pre></div>
<p dir="auto">When coming out of the <code class="notranslate">DataTransformer</code>, the data is this :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="array (size=2)
  '_other' =&gt; string '' (length=0)
  '_choices' =&gt; null"><pre class="notranslate"><code class="notranslate">array (size=2)
  '_other' =&gt; string '' (length=0)
  '_choices' =&gt; null
</code></pre></div>
<h3 dir="auto">Something else...</h3>
<p dir="auto">Something else which might be interesting is this block in <a href="symfony/src/Symfony/Component/Form/Form.php#623"><code class="notranslate">Form::submit</code> line 616-623</a>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                if (count($this-&gt;children) &gt; 0) {
                    // Use InheritDataAwareIterator to process children of
                    // descendants that inherit this form's data.
                    // These descendants will not be submitted normally (see the check
                    // for $this-&gt;config-&gt;getInheritData() above)
                    $childrenIterator = new InheritDataAwareIterator($this-&gt;children);
                    $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
                    $this-&gt;config-&gt;getDataMapper()-&gt;mapFormsToData($childrenIterator, $viewData);
                }"><pre class="notranslate"><code class="notranslate">                if (count($this-&gt;children) &gt; 0) {
                    // Use InheritDataAwareIterator to process children of
                    // descendants that inherit this form's data.
                    // These descendants will not be submitted normally (see the check
                    // for $this-&gt;config-&gt;getInheritData() above)
                    $childrenIterator = new InheritDataAwareIterator($this-&gt;children);
                    $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
                    $this-&gt;config-&gt;getDataMapper()-&gt;mapFormsToData($childrenIterator, $viewData);
                }
</code></pre></div>
<p dir="auto">When <code class="notranslate">$this-&gt;config-&gt;getDataMapper()-&gt;mapFormsToData($childrenIterator, $viewData);</code> is executed, <code class="notranslate">$viewData</code> contains an empty array, and this throw and Exception. But <code class="notranslate">var_dump($this-&gt;getViewData()))</code>, return <code class="notranslate">string '' (length=0)</code>. I wonder if the <code class="notranslate">$viewData</code> would have some transformation from an empty string to an empty array...</p>
<p dir="auto">But, if I replace <code class="notranslate">$this-&gt;config-&gt;getDataMapper()-&gt;mapFormsToData($childrenIterator, $viewData)</code> by <code class="notranslate">$this-&gt;config-&gt;getDataMapper()-&gt;mapFormsToData($childrenIterator, $this-&gt;getViewData())</code>, the validation does not pass any more.</p>
<p dir="auto">If you think this might be a bug, could you tell me how I should improve this bug report ? (I hadn't time to reproduce the bug).</p>
<p dir="auto"><strong>Symfony version(s) affected</strong>: 4.2.0, 4.1.* (and probably more, I din't test it)</p>
<p dir="auto"><strong>Description</strong><br>
When rendering a FormType containing a CollectionType, and that CollectionType also contains an other CollectionType, There is an error when trying to render this form in PHP Engine Only.<br>
Rendering the same form on Twig is working correctly.</p>
<p dir="auto"><strong>How to reproduce</strong></p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php
// Form/Type/TestType.php
namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;

class TestType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            -&gt;add('name')
            -&gt;add('multiple', CollectionType::class, [
                'entry_type' =&gt; TestSubType::class,
            ])
            -&gt;add('submit', SubmitType::class)
        ;
    }
}"><pre class="notranslate"><span class="pl-ent">&lt;?php</span>
<span class="pl-c">// Form/Type/TestType.php</span>
<span class="pl-k">namespace</span> <span class="pl-v">App</span>\<span class="pl-v">Form</span>;

<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">AbstractType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">Extension</span>\<span class="pl-v">Core</span>\<span class="pl-v">Type</span>\<span class="pl-v">CollectionType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">Extension</span>\<span class="pl-v">Core</span>\<span class="pl-v">Type</span>\<span class="pl-v">SubmitType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">FormBuilderInterface</span>;

<span class="pl-k">class</span> <span class="pl-v">TestType</span> <span class="pl-k">extends</span> <span class="pl-v">AbstractType</span>
{
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">buildForm</span>(<span class="pl-smi"><span class="pl-smi">FormBuilderInterface</span></span> <span class="pl-s1"><span class="pl-c1">$</span>builder</span>, <span class="pl-smi">array</span> <span class="pl-s1"><span class="pl-c1">$</span>options</span>)
    {
        <span class="pl-s1"><span class="pl-c1">$</span>builder</span>
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'name'</span>)
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'multiple'</span>, <span class="pl-v">CollectionType</span>::class, [
                <span class="pl-s">'entry_type'</span> =&gt; <span class="pl-v">TestSubType</span>::class,
            ])
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'submit'</span>, <span class="pl-v">SubmitType</span>::class)
        ;
    }
}</pre></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php
// Form/Type/TestSubType.php
namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

class TestSubType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            -&gt;add('testSub', TextType::class, [
                'label' =&gt; 'test Sub',
            ])
            -&gt;add('multipleSub', CollectionType::class, [
                'entry_type' =&gt; TestSubSubType::class,
            ])
        ;
    }
}"><pre class="notranslate"><span class="pl-ent">&lt;?php</span>
<span class="pl-c">// Form/Type/TestSubType.php</span>
<span class="pl-k">namespace</span> <span class="pl-v">App</span>\<span class="pl-v">Form</span>;

<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">AbstractType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">Extension</span>\<span class="pl-v">Core</span>\<span class="pl-v">Type</span>\<span class="pl-v">CollectionType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">Extension</span>\<span class="pl-v">Core</span>\<span class="pl-v">Type</span>\<span class="pl-v">TextType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">FormBuilderInterface</span>;

<span class="pl-k">class</span> <span class="pl-v">TestSubType</span> <span class="pl-k">extends</span> <span class="pl-v">AbstractType</span>
{
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">buildForm</span>(<span class="pl-smi"><span class="pl-smi">FormBuilderInterface</span></span> <span class="pl-s1"><span class="pl-c1">$</span>builder</span>, <span class="pl-smi">array</span> <span class="pl-s1"><span class="pl-c1">$</span>options</span>)
    {
        <span class="pl-s1"><span class="pl-c1">$</span>builder</span>
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'testSub'</span>, <span class="pl-v">TextType</span>::class, [
                <span class="pl-s">'label'</span> =&gt; <span class="pl-s">'test Sub'</span>,
            ])
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'multipleSub'</span>, <span class="pl-v">CollectionType</span>::class, [
                <span class="pl-s">'entry_type'</span> =&gt; <span class="pl-v">TestSubSubType</span>::class,
            ])
        ;
    }
}</pre></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php
// Form/Type/TestSubSubType.php
namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class TestSubSubType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            -&gt;add('name')
        ;
    }
}"><pre class="notranslate"><span class="pl-ent">&lt;?php</span>
<span class="pl-c">// Form/Type/TestSubSubType.php</span>
<span class="pl-k">namespace</span> <span class="pl-v">App</span>\<span class="pl-v">Form</span>;

<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">AbstractType</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Form</span>\<span class="pl-v">FormBuilderInterface</span>;

<span class="pl-k">class</span> <span class="pl-v">TestSubSubType</span> <span class="pl-k">extends</span> <span class="pl-v">AbstractType</span>
{
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">buildForm</span>(<span class="pl-smi"><span class="pl-smi">FormBuilderInterface</span></span> <span class="pl-s1"><span class="pl-c1">$</span>builder</span>, <span class="pl-smi">array</span> <span class="pl-s1"><span class="pl-c1">$</span>options</span>)
    {
        <span class="pl-s1"><span class="pl-c1">$</span>builder</span>
            -&gt;<span class="pl-en">add</span>(<span class="pl-s">'name'</span>)
        ;
    }
}</pre></div>
<p dir="auto">In controller, create the form and send it to a PHP view:<br>
NB : the error occurs only when multiple have a least 1 line</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        $data = [
            'name' =&gt; 'name 1',
            'multiple' =&gt; [
                [
                    'testSub' =&gt; 'Name 2',
                    'multipleSub' =&gt; [
                        [
                            'name' =&gt; 'name 3',
                        ],
                    ],
                ],
            ],
        ];

        $form = $this-&gt;createForm(TestType::class, $data);

        return $this-&gt;render('front/index.html.php', [
            'form' =&gt; $form-&gt;createView(),
        ]);"><pre class="notranslate">        <span class="pl-s1"><span class="pl-c1">$</span>data</span> = [
            <span class="pl-s">'name'</span> =&gt; <span class="pl-s">'name 1'</span>,
            <span class="pl-s">'multiple'</span> =&gt; [
                [
                    <span class="pl-s">'testSub'</span> =&gt; <span class="pl-s">'Name 2'</span>,
                    <span class="pl-s">'multipleSub'</span> =&gt; [
                        [
                            <span class="pl-s">'name'</span> =&gt; <span class="pl-s">'name 3'</span>,
                        ],
                    ],
                ],
            ],
        ];

        <span class="pl-s1"><span class="pl-c1">$</span>form</span> = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-en">createForm</span>(<span class="pl-v">TestType</span>::class, <span class="pl-s1"><span class="pl-c1">$</span>data</span>);

        <span class="pl-k">return</span> <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-en">render</span>(<span class="pl-s">'front/index.html.php'</span>, [
            <span class="pl-s">'form'</span> =&gt; <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">createView</span>(),
        ]);</pre></div>
<p dir="auto">In index.html.php, simply render the form:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php echo $view['form']-&gt;form($form); ?&gt;"><pre class="notranslate"><span class="pl-ent">&lt;?php</span> <span class="pl-k">echo</span> <span class="pl-s1"><span class="pl-c1">$</span>view</span>[<span class="pl-s">'form'</span>]-&gt;<span class="pl-en">form</span>(<span class="pl-s1"><span class="pl-c1">$</span>form</span>); <span class="pl-ent">?&gt;</span></pre></div>
<p dir="auto"><strong>Possible Solution</strong><br>
I figured out where the problem comes from, but I'm lacking background oho Symfony Form to fix it correctly, regarding the performance.<br>
In <code class="notranslate">Symfony\Component\Form\AbstractRendererEngine</code>, we have those lines:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// The next two if statements contain slightly duplicated code. This is by intention
// and tries to avoid execution of unnecessary checks in order to increase performance.
if (isset($this-&gt;resources[$cacheKey][$parentBlockName])) {
    // It may happen that the parent block is already loaded, but its level is not.
    // In this case, the parent block must have been loaded by loadResourceForBlock(),
    // which does not check the hierarchy of the block. Subsequently the block must have
    // been found directly on the parent level.
    if (!isset($this-&gt;resourceHierarchyLevels[$cacheKey][$parentBlockName])) {
        $this-&gt;resourceHierarchyLevels[$cacheKey][$parentBlockName] = $parentLevel;
    }

    // Cache the shortcuts for further accesses
    $this-&gt;resources[$cacheKey][$blockName] = $this-&gt;resources[$cacheKey][$parentBlockName];
    $this-&gt;resourceHierarchyLevels[$cacheKey][$blockName] = $this-&gt;resourceHierarchyLevels[$cacheKey][$parentBlockName];

    return true;
}"><pre class="notranslate"><span class="pl-c">// The next two if statements contain slightly duplicated code. This is by intention</span>
<span class="pl-c">// and tries to avoid execution of unnecessary checks in order to increase performance.</span>
<span class="pl-k">if</span> (isset(<span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resources</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>])) {
    <span class="pl-c">// It may happen that the parent block is already loaded, but its level is not.</span>
    <span class="pl-c">// In this case, the parent block must have been loaded by loadResourceForBlock(),</span>
    <span class="pl-c">// which does not check the hierarchy of the block. Subsequently the block must have</span>
    <span class="pl-c">// been found directly on the parent level.</span>
    <span class="pl-k">if</span> (!isset(<span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resourceHierarchyLevels</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>])) {
        <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resourceHierarchyLevels</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>] = <span class="pl-s1"><span class="pl-c1">$</span>parentLevel</span>;
    }

    <span class="pl-c">// Cache the shortcuts for further accesses</span>
    <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resources</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>blockName</span>] = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resources</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>];
    <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resourceHierarchyLevels</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>blockName</span>] = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resourceHierarchyLevels</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>];

    <span class="pl-k">return</span> <span class="pl-c1">true</span>;
}</pre></div>
<p dir="auto">When commenting them, everything works fine.<br>
An other solution is to modify the if check in this way:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if (isset($this-&gt;resources[$cacheKey][$parentBlockName]) &amp;&amp; false !== $this-&gt;resources[$cacheKey][$parentBlockName]) {"><pre class="notranslate"><span class="pl-k">if</span> (isset(<span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resources</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>]) &amp;&amp; <span class="pl-c1">false</span> !== <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">resources</span>[<span class="pl-s1"><span class="pl-c1">$</span>cacheKey</span>][<span class="pl-s1"><span class="pl-c1">$</span>parentBlockName</span>]) {</pre></div>
<p dir="auto"><strong>Additional context</strong><br>
What looks very weird to me is that these lines was introduced 7 years ago by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/webmozart/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/webmozart">@webmozart</a> .<br>
I can't think that this bug was here and nobody had trouble with it before me.</p>