-
Notifications
You must be signed in to change notification settings - Fork 555
Fix phpstan/phpstan#14305: Internal error crash report #5231
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| parameters: | ||
| level: 5 | ||
| paths: | ||
| - test.php |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
|
|
||
| namespace Bug14305; | ||
|
|
||
| define('BUG14305_XDOC_GMETA_EMTY', 0); | ||
| define('BUG14305_XDOC_GMETA_NUPATH', 7); | ||
| define('BUG14305_XDOC_GMETAS', [ | ||
| 'empty' => 0, | ||
| 'nupath' => 7, | ||
| ]); | ||
|
|
||
| $row = ['id' => 0]; | ||
|
|
||
| foreach ([BUG14305_XDOC_GMETA_EMTY, BUG14305_XDOC_GMETA_NUPATH] as $meta) | ||
| $row[array_search($meta, BUG14305_XDOC_GMETAS)] = ''; | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -291,6 +291,23 @@ public function setOffsetValueType(?Type $offsetType, Type $valueType, bool $opt | |||
| $this->keyTypes[] = $scalarType; | ||||
| $this->valueTypes[] = $valueType; | ||||
| $this->optionalKeys[] = count($this->keyTypes) - 1; | ||||
|
|
||||
| if (!($scalarType instanceof ConstantIntegerType)) { | ||||
| continue; | ||||
| } | ||||
|
Comment on lines
+295
to
+297
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we need to use wdyt @VincentLanglet ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I processed this review but have nothing to report.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm the origin reproducer causes a exception here:
I feel this fix is wonky
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I processed this review but have nothing to report.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scalar types should be already casted because of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I processed this review but have nothing to report. |
||||
|
|
||||
| $max = max($this->nextAutoIndexes); | ||||
| $offsetValue = $scalarType->getValue(); | ||||
| if ($offsetValue < $max) { | ||||
| continue; | ||||
| } | ||||
|
|
||||
| /** @var int|float $newAutoIndex */ | ||||
| $newAutoIndex = $offsetValue + 1; | ||||
| if (is_float($newAutoIndex)) { | ||||
| $newAutoIndex = $max; | ||||
| } | ||||
| $this->nextAutoIndexes[] = $newAutoIndex; | ||||
| } | ||||
|
|
||||
| $this->isList = TrinaryLogic::createNo(); | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.