Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overridden ini values are ignored when php.ini uses section headers #60

Closed
Emosewaj opened this issue Jul 8, 2021 · 2 comments
Closed

Comments

@Emosewaj
Copy link

Emosewaj commented Jul 8, 2021

As of right now, Runtime::getCurrentSettings() parses php.ini files respecting section headers using the optional $process_sections parameter of parse_ini_file(), however, these section headers are then later ignored when comparing the ini file's values to the value retrieved by ini_get(). This erroneously causes some ini values that have been overridden via the command line to be ignored and don't get passed through if they either don't exist in the ini file or are under a section header:

; php.ini
[xdebug]
xdebug.mode=debug

$config = parse_ini_file($ini, true) results in

array(1) {
  'xdebug' =>
  array(1) {
    'xdebug.mode' =>
    string(5) "debug"
  }
}

$config = parse_ini_file($ini) results in

array(1) {
  'xdebug.mode' =>
  string(5) "debug"
}

Additionally, I believe
if (isset($config[$value]) && $set != $config[$value])
should be changed to
if (!isset($config[$value]) || $set != $config[$value])
as otherwise, values not set in php.ini but set through the command line would also not be passed through.

@sebastianbergmann
Copy link
Owner

Was this fixed by #63?

@Emosewaj
Copy link
Author

It was, I'm no longer encountering this issue on 5.1.4.

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

No branches or pull requests

2 participants