Skip to content

test: restore PHP environment snippet contract - #2351

Merged
chubes4 merged 1 commit into
mainfrom
fix-2347-php-env-snippet-contract
Aug 24, 2026
Merged

test: restore PHP environment snippet contract#2351
chubes4 merged 1 commit into
mainfrom
fix-2347-php-env-snippet-contract

Conversation

@chubes4

@chubes4 chubes4 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore the exact phpEnvAssignments() smoke contract for putenv(), $_ENV, and $_SERVER
  • exercise quote, newline, and backslash escaping through generated PHP
  • prove invalid-name rejection and output parity between static snippet generation and phpEnvAssignmentFunction()

Root cause

#1912 / 13ccafb5 intentionally expanded static PHP environment assignment from putenv() alone to all three PHP environment surfaces, matching the runtime helper. The smoke fixture retained the old one-line expectation, so npm run check failed even though the implementation contract was correct.

Contract

For every accepted environment name and stringified value, both generation paths populate:

  1. getenv() through putenv()
  2. $_ENV
  3. $_SERVER

Invalid names remain rejected. The test uses an escaped value containing quotes, a newline, and a backslash and compares the executable static/runtime results.

Tests

Fixes #2347

@chubes4
chubes4 merged commit 5638181 into main Aug 24, 2026
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.

php-snippets-smoke fails on main after env assignment contract expanded

1 participant