FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make the putenv adapter null-byte safe by GrahamCampbell · Pull Request #603 · vlucas/phpdotenv · GitHub

Make the putenv adapter null-byte safe - #603

Merged
GrahamCampbell merged 1 commit into
masterfrom
fix/putenv-null-byte-safety
Aug 24, 2026
Merged

Make the putenv adapter null-byte safe#603
GrahamCampbell merged 1 commit into
masterfrom
fix/putenv-null-byte-safety

Conversation

Copy link
Copy Markdown
Collaborator

On PHP 8.6 putenv and getenv throw a ValueError when a name or value contains a null byte, and because the parser preserves null bytes and the repository name guard only rejects the empty string, such a byte reaches the putenv-backed adapter through a loaded file value or a direct set, get or clear call and crashes, uncaught, with safeLoad unable to suppress it. On earlier versions the same input is silently truncated at the null byte, which can quietly unset an unrelated variable. Guarding all three adapter methods against null bytes in the name, and the write against a null byte in the value, makes the operation simply fail, consistently across versions, matching the adapter's existing may-fail contract. This is stacked on #602 and is intended to land before v5.7.0 is tagged.

GrahamCampbell force-pushed the fix/putenv-null-byte-safety branch from 1c34d13 to 488f91e Compare August 24, 2026 01:01
GrahamCampbell force-pushed the fix/utf8-name-validation-modifier branch from b3d755d to cc880ae Compare August 24, 2026 10:42
GrahamCampbell force-pushed the fix/putenv-null-byte-safety branch 2 times, most recently from d0a2385 to 8fdf977 Compare August 24, 2026 13:22
GrahamCampbell force-pushed the fix/utf8-name-validation-modifier branch from 558a54a to 5249b62 Compare August 24, 2026 17:28
GrahamCampbell force-pushed the fix/putenv-null-byte-safety branch from 8fdf977 to 979a77d Compare August 24, 2026 17:28
GrahamCampbell force-pushed the fix/utf8-name-validation-modifier branch from 5249b62 to 1c2769e Compare August 24, 2026 17:43
GrahamCampbell force-pushed the fix/putenv-null-byte-safety branch from 979a77d to 63d1654 Compare August 24, 2026 17:43
Base automatically changed from fix/utf8-name-validation-modifier to master August 24, 2026 17:45
GrahamCampbell force-pushed the fix/putenv-null-byte-safety branch from 63d1654 to 6f2f014 Compare August 24, 2026 17:46
GrahamCampbell merged commit 46d5ce3 into master Aug 24, 2026
42 checks passed
GrahamCampbell deleted the fix/putenv-null-byte-safety branch August 24, 2026 17:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL