Repository navigation
Taint the items destructured from a mixed value or an ArrayAccess object - #14225
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9f8b011. Configure here.
| $array_type, | ||
| $offset_value, | ||
| Type::getMixed(), | ||
| )->parent_nodes); |
There was a problem hiding this comment.
Mixed check ignores assigned type
Medium Severity
addDestructuredVariableDataFlow runs the mixed-only destructuring taint path when array_type->hasMixed() is true, but the method’s own docblock says this flow applies when the assigned variable’s type stays mixed. After a concrete item type is merged into new_assign_type, the variable may no longer be mixed while the RHS union still is, so an extra mixed destructuring fetch can attach incorrect taint parents.
Reviewed by Cursor Bugbot for commit 9f8b011. Configure here.
There was a problem hiding this comment.
Not a bug: the extra fetch takes the item at the same offset from the same value the array path fetches it from, so it adds no taint the item does not hold (and Psalm collapses a union with mixed to mixed, so in practice the value is mixed alone). The docblock read like a condition on the type; reworded in cf17644.
✅ Performance: unchanged · Types: unchanged
How to read this table
head dd17078 · base dd17078 (merge-base) · workflow run |
# Conflicts: # src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php # tests/TaintTest.php


mixedvaluesPsalm misses taints in the items destructured from a
mixedvalue, such as a row fromPDOStatement::fetch().Before
After
ArrayAccess objects
Psalm misses taints in the items destructured from an
ArrayAccessobject.Before
After