Commit e25b004
committed
[Dotenv] Don't truncate OS env vars containing $ when $_ENV is unpopulated
PR #63955 introduced `loadedRawVars` tracking in `doLoad()`. Its check
`!isset($_ENV[$name])` was meant to protect host-provided environment
variables from being processed by `resolveLoadedVars()`. However, with
PHP's default `variables_order = "GPCS"` (no `E`), OS-provided env vars
are placed in $_SERVER but not in $_ENV when PHP starts.
As a result, an externally provided value like `abc$def` was added to
`loadedRawVars`, and then `resolveLoadedVars()` interpreted the literal
`$` as a variable reference and truncated the value to `abc`.
Mirror the existing behavior of `populate()` which already considers
$_SERVER as a source of pre-existing env vars, so externally provided
values are correctly recognized regardless of `variables_order`.1 parent 381ab08 commit e25b004
2 files changed
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
677 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
678 | 679 | | |
679 | | - | |
| 680 | + | |
680 | 681 | | |
681 | 682 | | |
682 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
276 | 306 | | |
277 | 307 | | |
278 | 308 | | |
| |||
0 commit comments