Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Runtime] Support runtime options as a string#61522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.4fromVincentLanglet:runtimeOptions
Aug 27, 2025

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLangletVincentLanglet commentedAug 25, 2025
edited by fabpot
Loading

QA
Branch?7.4
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix#60755
LicenseMIT

cc@nicolas-grekas since I think you worked a lot on this.

When setting the APP_RUNTIME_OPTIONS with docker or anything else than php, only a string can be used ; so it could be useful to support a string format for such options, I propose the classic json format and then use json_decode on string.

WDYT ?

I'm unsure how this template is tested...

Spomky reacted with thumbs up emoji
@carsonbotcarsonbot added this to the7.4 milestoneAug 25, 2025
@carsonbotcarsonbot changed the titleSupport runtime options as a string Support runtime options as a stringAug 25, 2025
@carsonbotcarsonbot changed the title Support runtime options as a string[Runtime] Support runtime options as a stringAug 25, 2025
@Spomky
Copy link
Contributor

Looks good to me.
An env var is always a string anyway, so supporting JSON here makes sense.

You could addJSON_THROW_ON_ERROR and fail clearly on invalid JSON,

@nicolas-grekas
Copy link
Member

Very close to#45535.

Did you consider populating$_SERVER['APP_RUNTIME_OPTIONS'] in yourindex.php file instead? Just wondering about alternatives:

--- a/public/index.php+++ b/public/index.php@@ -4,6 +4,10 @@ use App\Kernel;  require_once dirname(__DIR__).'/vendor/autoload_runtime.php';+if (is_string($_SERVER['APP_RUNTIME_OPTIONS'] ??= $_ENV['APP_RUNTIME_OPTIONS'] ?? [])) {+    $_SERVER['APP_RUNTIME_OPTIONS'] = json_decode($_SERVER['APP_RUNTIME_OPTIONS'], true, JSON_THROW_ON_ERROR);+}+ return function (array $context) {     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); };

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

/cc@ro0NL FYI

@VincentLanglet
Copy link
ContributorAuthor

Did you consider populating$_SERVER['APP_RUNTIME_OPTIONS'] in yourindex.php file instead? Just wondering about alternatives:

--- a/public/index.php+++ b/public/index.php@@ -4,6 +4,10 @@ use App\Kernel;  require_once dirname(__DIR__).'/vendor/autoload_runtime.php';+if (is_string($_SERVER['APP_RUNTIME_OPTIONS'] ??= $_ENV['APP_RUNTIME_OPTIONS'] ?? [])) {+    $_SERVER['APP_RUNTIME_OPTIONS'] = json_decode($_SERVER['APP_RUNTIME_OPTIONS'], true, JSON_THROW_ON_ERROR);+}+ return function (array $context) {     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); };

"Funny", I currently only used the bin/console so I added a similar check in my bin/console file but indeed, I will certainly have the same need in the index.php.

I think adding this directly in Symfony runtime will

  • avoid people to add this themself
  • avoid having to add this on different php files (index.php, bin/console, another ?)

I'm only sad about the fact it's obviously considered as a new feature and I'll have to wait 7.4 ^^

nicolas-grekas reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

(please add a line in the changelog of the component)

@VincentLanglet
Copy link
ContributorAuthor

(please add a line in the changelog of the component)

Updated

nicolas-grekas reacted with thumbs up emoji

7.4
---

* Add support for using json_encoded`APP_RUNTIME_OPTIONS` value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
* Add support for usingjson_encoded`APP_RUNTIME_OPTIONS` value
* Add support for usinga JSON encoded value for`APP_RUNTIME_OPTIONS`

@fabpot
Copy link
Member

Thank you@VincentLanglet.

@fabpotfabpot merged commitc228caa intosymfony:7.4Aug 27, 2025
11 of 12 checks passed
fabpot added a commit that referenced this pull requestSep 3, 2025
…UNTIME']` (nicolas-grekas)This PR was merged into the 7.4 branch.Discussion----------[Runtime] Expose the runtime class in `$_SERVER['APP_RUNTIME']`| Q             | A| ------------- | ---| Branch?       | 7.4| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Issues        | -| License       | MITLet's make this var consistently contain the runtime class.Options were already make so in#61522Commits-------1f1bf89 [Runtime] Expose the runtime class in `$_SERVER['APP_RUNTIME']`
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

Allow to set disable_dotenv via environment variable

6 participants

@VincentLanglet@Spomky@nicolas-grekas@fabpot@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp