Browse Source

Fix JsonConfigSource fallback on php5.3, refs #4972

Jordi Boggiano 9 years ago
parent
commit
2ff19e4c62
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/Composer/Config/JsonConfigSource.php

+ 6 - 6
src/Composer/Config/JsonConfigSource.php

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