Skip to content

Stuck process when modifyind array in foreach #13310

@PhilippeThouvenot

Description

@PhilippeThouvenot

Bug report

Issue appears from 2.1.18
Process stuck with this code :
Level 0

`<?php
function get_array(): array
{
return [];
}

$tests = get_array();

foreach ($tests as $test) {

// information fichiers
$test['information'] = '';
$test['information'] .= $test['a'] ? 'test' : '';
$test['information'] .= $test['b'] ? 'test' : '';
$test['information'] .= $test['c'] ? 'test' : '';
$test['information'] .= $test['d'] ? 'test' : '';
$test['information'] .= $test['e'] ? 'test' : '';
$test['information'] .= $test['f'] ? 'test' : '';
$test['information'] .= $test['g'] ? 'test' : '';
$test['information'] .= $test['h'] ? 'test' : '';

}
`

I can't share a snippet withi this code, the playground fail to create share.

Code snippet that reproduces the problem

No response

Expected output

Working

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions