Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis of a file with + operator on array shapes takes forever #6936

Closed
staabm opened this issue Mar 29, 2022 · 3 comments
Closed

Analysis of a file with + operator on array shapes takes forever #6936

staabm opened this issue Mar 29, 2022 · 3 comments

Comments

@staabm
Copy link
Contributor

staabm commented Mar 29, 2022

Bug report

analysing this code runs for 2-3 minutes. it involves UnionTypes with 263169 elements and more

<?php

class clxAuftragController
{
	public function save_auftrag_changes()
	{
		foreach ($_POST['adansch'] as $avkid => $adansch) {
			$change = 0;
			$col = [];
			if ($adansch['telefon'] != $aktueller_endkunde->telefon && '' != $adansch['telefon']) {
				$col['telefon'] = $adansch['telefon'];
				$change = 1;
			}
			if ($adansch['email'] != $aktueller_endkunde->email && '' != $adansch['email']) {
				$col['email'] = $adansch['email'];
				$change = 1;
			}
			if ($adansch['fa_gruendungsjahr'] != $aktueller_endkunde->fa_gruendungsjahr) {
				$col['fa_gruendungsjahr'] = $adansch['fa_gruendungsjahr'];
				$change = 1;
			}
			if ($adansch['fa_geschaeftsfuehrer'] != $aktueller_endkunde->fa_geschaeftsfuehrer) {
				$col['fa_geschaeftsfuehrer'] = $adansch['fa_geschaeftsfuehrer'];
				$change = 1;
			}
			if ($adansch['handelregnr'] != $aktueller_endkunde->handelregnr) {
				$col['handelregnr'] = $adansch['handelregnr'];
				$change = 1;
			}
			if ($adansch['amtsgericht'] != $aktueller_endkunde->amtsgericht) {
				$col['amtsgericht'] = $adansch['amtsgericht'];
				$change = 1;
			}
			if ($adansch['ustid'] != $aktueller_endkunde->ustid) {
				$col['ustid'] = $adansch['ustid'];
				$change = 1;
			}
			if ($adansch['ustnr'] != $aktueller_endkunde->ustnr) {
				$col['ustnr'] = $adansch['ustnr'];
				$change = 1;
			}

			if ($adansch['firma'] != $aktueller_endkunde->firma) {
				$col['firma'] = $adansch['firma'];
				$change = 1;
			}

			if (1 == $change) {
				// MobisHelper::createXmlDataJob("ada",(int)$aktueller_endkunde->adaid, $col);
				if (!isset($_SENDJOB[$avk->avkid]['ada'][$aktueller_endkunde->adaid])) {
					$_SENDJOB[$avk->avkid]['ada'][$aktueller_endkunde->adaid] = [];
				}

				$_SENDJOB[$avk->avkid]['ada'][$aktueller_endkunde->adaid] = $_SENDJOB[$avk->avkid]['ada'][$aktueller_endkunde->adaid] + $col;
			}
		}
	}
}

I am already working on a fix

@mergeable
Copy link

mergeable bot commented Mar 29, 2022

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#1141

@github-actions
Copy link

github-actions bot commented May 1, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants