Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Exponential complexity when appending an array to itself #6948

@schlndh

Description

@schlndh

Bug report

The complexity of inferring the type of an array grows exponentially in the following case:

<?php
$row = [1];

if (rand()) {
	$row[] = $row;
}
// repeat the condition as many times as you want...

With 9 copies of the condition it takes 2.5s for me, with 10 it's 7.3s and with 11 it's 23.1s. I'm using version 1.5.2.

The issue is a bit similar to #4883 but it achieves exponential behavior in a different way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions