Skip to content

PHPStan hangs on analysing small function #3686

@phpfui

Description

@phpfui

Bug report

On PHPStan 0.12.33 under Windows 10, PHP 7.4.6.

PHPStan hangs on processing this file (chopped down from working code, this code does not make sense):

Code snippet that reproduces the problem

function fred($request)
	{
		$keys = '';
		foreach ($request as $index)
			{
			foreach ($index as $field)
				{
				if (isset($keys[$field]))
					{
					$keys[$field] = 0;
					}
				}
			}
	}

Expected output

PHPStan finishes, probably with some errors, but it never returns.

It is the first and only file processed. Level 1. If you change just about anything, it does not hang. This is the smallest snippet of code I could make hang. It was hanging on old production code, so pretty sure the code is valid PHP and works correctly with no errors or warnings reported.

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