[ 
https://issues.apache.org/jira/browse/SHINDIG-1309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852376#action_12852376
 ] 

Jacky Wang commented on SHINDIG-1309:
-------------------------------------

It has been fixed.

> ContainerConfig Unable to Parse JSON Configuration File
> -------------------------------------------------------
>
>                 Key: SHINDIG-1309
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1309
>             Project: Shindig
>          Issue Type: Bug
>          Components: PHP
>         Environment: php 5.2
>            Reporter: Erik Giberti
>            Priority: Blocker
>
> 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;
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to