Commit 04242cf
committed
Avoid using a null alias as an array offset in getAliases()
SelectStatement::getAliases() built a table-alias map with
`$tables[$thisDb][$expr->alias] = $expr->table` for every FROM/JOIN
expression. When a table has no alias, `$expr->alias` is null, so this
used null as an array offset, which is deprecated as of PHP 8.5
("Using null as an array offset is deprecated, use an empty string
instead"). The null-keyed entry was never read back either: the only
consumer looks up `$tables[$thisDb][$expr->table]`, whose offset is
always a non-empty string.
Skip expressions without an alias, mirroring the existing
`isset($expr->alias) && $expr->alias !== ''` checks above. getAliases()
output is unchanged. Removes the now-resolved PossiblyNullArrayOffset
entry from the Psalm baseline and adds a regression test.1 parent 0ee3626 commit 04242cf
3 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
809 | | - | |
810 | 809 | | |
811 | 810 | | |
812 | 811 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
610 | 617 | | |
611 | 618 | | |
612 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
158 | 180 | | |
159 | 181 | | |
160 | 182 | | |
0 commit comments