Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1309

ContainerConfig Unable to Parse JSON Configuration File

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • None
    • PHP
    • php 5.2

    Description

      I was able to trace the problem back to the regular expression in the method ContainerConfig::removeComments which stripped comments from the contents. It was incorrectly removing everything after the double slash in variables like this: "gadgets.oauthGadgetCallbackTemplate" : "//%host%/gadgets/oauthcallback" I also added the file being parsed to the exception which is consistent with the style in the method ContainerConfig::loadFromFile

      This patch simply reverts to an earlier version.

      Index: php/src/gadgets/ContainerConfig.php
      ===================================================================
      — php/src/gadgets/ContainerConfig.php (revision 927023)
      +++ php/src/gadgets/ContainerConfig.php (working copy)
      @@ -51,7 +51,7 @@
      $contents = self::removeComments($contents);
      $config = json_decode($contents, true);
      if ($config == $contents)

      { - throw new Exception("Failed to json_decode the container configuration"); + throw new Exception("Failed to json_decode the container configuration $file"); }

      if (! isset($config[$this->container_key][0]))

      { throw new Exception("No gadgets.container value set for current container"); @@ -68,7 +68,7 @@ $str = preg_replace('@/\\*.*?\\*/@s', '', $str); // remove // style comments, but keep 'http://' 'https://' and '"//' // for example: "gadgets.oauthGadgetCallbackTemplate" : "//%host%/gadgets/oauthcallback" - $str = preg_replace('/(?<!http:|https:)\/\/.*$/m', '', $str); + $str = preg_replace('/[^http:\/\/|^https:\/\/|"\/\/]\/\/.*$/m', '', $str); return $str; }

      Attachments

        Activity

          People

            Unassigned Unassigned
            giberti Erik Giberti
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment