[Solar-svn] Revision 3120

pmjones at solarphp.com pmjones at solarphp.com
Mon Apr 14 20:25:15 CDT 2008


Solar_Uri: [FIX] Per talks w/Antti Holvikari, use `trim($var) == ''` instead of `! $var` to allow for a string '0' in the format and fragment portions.


Modified: trunk/Solar/Uri.php
===================================================================
--- trunk/Solar/Uri.php	2008-04-15 01:23:21 UTC (rev 3119)
+++ trunk/Solar/Uri.php	2008-04-15 01:25:13 UTC (rev 3120)
@@ -428,13 +428,14 @@
                   . (empty($this->port) ? '' : ':' . (int) $this->port);
         }
         
-        // add the rest of the URI
+        // add the rest of the URI. we use trim() instead of empty() on string
+        // elements to allow for string-zero values.
         return $uri
              . $this->_config['path']
-             . (empty($this->path)     ? '' : $this->_pathEncode($this->path))
-             . (empty($this->format)   ? '' : '.' . urlencode($this->format))
-             . (empty($this->query)    ? '' : '?' . http_build_query($this->query))
-             . (empty($this->fragment) ? '' : '#' . urlencode($this->fragment));
+             . (empty($this->path)           ? '' : $this->_pathEncode($this->path))
+             . (trim($this->format) == ''    ? '' : '.' . urlencode($this->format))
+             . (empty($this->query)          ? '' : '?' . http_build_query($this->query))
+             . (trim($this->fragment) == ''  ? '' : '#' . urlencode($this->fragment));
     }
     
     /**
@@ -457,7 +458,6 @@
         return $uri->get($full);
     }
     
-    
     /**
      * 
      * Sets the Solar_Uri::$query array from a string.




More information about the Solar-svn mailing list