1
0
Fork 0

Fix JsonConfigSource fallback on php5.3, refs #4972

pull/4977/head
Jordi Boggiano 2016-02-29 14:17:24 +00:00
parent f2e2dd8f86
commit 2ff19e4c62
1 changed files with 6 additions and 6 deletions

View File

@ -79,11 +79,11 @@ class JsonConfigSource implements ConfigSourceInterface
*/ */
public function addConfigSetting($name, $value) public function addConfigSetting($name, $value)
{ {
$that = $this; $authConfig = $this->authConfig;
$this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($that) { $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) { if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
list($key, $host) = explode('.', $key, 2); list($key, $host) = explode('.', $key, 2);
if ($that->authConfig) { if ($authConfig) {
$config[$key][$host] = $val; $config[$key][$host] = $val;
} else { } else {
$config['config'][$key][$host] = $val; $config['config'][$key][$host] = $val;
@ -99,11 +99,11 @@ class JsonConfigSource implements ConfigSourceInterface
*/ */
public function removeConfigSetting($name) public function removeConfigSetting($name)
{ {
$that = $this; $authConfig = $this->authConfig;
$this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($that) { $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) { if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
list($key, $host) = explode('.', $key, 2); list($key, $host) = explode('.', $key, 2);
if ($that->authConfig) { if ($authConfig) {
unset($config[$key][$host]); unset($config[$key][$host]);
} else { } else {
unset($config['config'][$key][$host]); unset($config['config'][$key][$host]);