Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
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)
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; }