Commit fb8777b
[VarExporter] Fix export of string parameter defaults containing escaped quotes
Reflection renders string defaults lossily: inner single quotes are
emitted unescaped and backslashes are double-escaped, so re-tokenizing
the rendered default in exportDefault() produces broken PHP in the
generated lazy-proxy code (parse error at best).
For any rendering that looks like a pure quoted string, export the real
value returned by ReflectionParameter::getDefaultValue() instead,
keeping the token-based path as a fallback when the value cannot be
resolved.1 parent 1d8a783 commit fb8777bCopy full SHA for fb8777b
2 files changed
+63Lines changed: 63 additions & 0 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src/Symfony/Component/VarExporter
- Tests
Expand file treeCollapse file tree
Open diff view settings
Collapse file
src/Symfony/Component/VarExporter/ProxyHelper.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/VarExporter/ProxyHelper.php+28Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
510 | 510 | |
511 | 511 | |
512 | 512 | |
| 513 | + |
| 514 | + |
| 515 | + |
| 516 | + |
| 517 | + |
| 518 | + |
| 519 | + |
| 520 | + |
| 521 | + |
| 522 | + |
| 523 | + |
| 524 | + |
| 525 | + |
| 526 | + |
513 | 527 | |
514 | 528 | |
515 | 529 | |
| ||
550 | 564 | |
551 | 565 | |
552 | 566 | |
| 567 | + |
| 568 | + |
| 569 | + |
| 570 | + |
| 571 | + |
| 572 | + |
| 573 | + |
| 574 | + |
| 575 | + |
| 576 | + |
| 577 | + |
| 578 | + |
| 579 | + |
| 580 | + |
553 | 581 | |
Collapse file
src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php+35Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
166 | 166 | |
167 | 167 | |
168 | 168 | |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
169 | 187 | |
170 | 188 | |
171 | 189 | |
| ||
329 | 347 | |
330 | 348 | |
331 | 349 | |
| 350 | + |
| 351 | + |
| 352 | + |
| 353 | + |
| 354 | + |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
| 359 | + |
| 360 | + |
| 361 | + |
| 362 | + |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | + |
332 | 367 | |
333 | 368 | |
334 | 369 | |
|
0 commit comments