Commit 86b43ec
committed
PHP 8.4 | Security/EscapeOutput: handle exit/die using named parameters
As of PHP 8.4, the internal of `T_EXIT` are changing in PHP itself and `exit`/`die` will internally be treated as a function call.
The net effect of this is that named parameters can now be used with `exit()`/`die()`.
For the `WordPress.Security.EscapeOutput` sniff this would lead to false positives as the parameter name would be seen as "not escaped".
As of PHPCSUtils 1.1.0, the methods within the `PassedParameters` class will allow for passing a `T_EXIT` token. This, in turn, allows for handling `exit`/`die` with named parameters correctly in the context of the `EscapeOutput` sniff.
This commit implements using the `PassedParameters` class for parsing calls to `exit`/`die`, which fixes the issue.
Includes tests.
Ref: https://wiki.php.net/rfc/exit-as-function1 parent a74a579 commit 86b43ec
File tree
3 files changed
+19
-10
lines changed- WordPress
- Sniffs/Security
- Tests/Security
3 files changed
+19
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
| |||
0 commit comments