Author: chabotc
Date: Wed Jun 11 05:55:24 2008
New Revision: 666647

URL: http://svn.apache.org/viewvc?rev=666647&view=rev
Log:
Comment stripping broke the configuration on http:// style texts

Modified:
    incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php

Modified: incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php?rev=666647&r1=666646&r2=666647&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php Wed Jun 11 
05:55:24 2008
@@ -53,10 +53,13 @@
                $contents = file_get_contents($file);
                // remove all comments (both /* */ and // style) because this 
confuses the json parser
                // note: the json parser also crashes on trailing ,'s in 
records so please don't use them
-               $contents = preg_replace('/\/\/.*$/m', '', 
preg_replace('@/\\*(?:.|[\\n\\r])*?\\*/@', '', $contents));
+               $contents = preg_replace('/[^http:\/\/|^https:\/\/]\/\/.*$/m', 
'', preg_replace('@/\\*(?:.|[\\n\\r])*?\\*/@', '', $contents));
                $config = json_decode($contents, true);
+               if ($config == $contents) {
+                       throw new Exception("Failed to json_decode the 
container configuration");
+               }
                if (! isset($config[$this->container_key][0])) {
-                       throw new Exception("No gadgets.container value set for 
");
+                       throw new Exception("No gadgets.container value set for 
current container");
                }
                $container = $config[$this->container_key][0];
                $this->config[$container] = array();


Reply via email to