diff --git a/framework/Routes/lib/Horde/Routes/Route.php b/framework/Routes/lib/Horde/Routes/Route.php
index 23d3eeb..91ed844 100644
--- a/framework/Routes/lib/Horde/Routes/Route.php
+++ b/framework/Routes/lib/Horde/Routes/Route.php
@@ -747,7 +747,7 @@ class Horde_Routes_Route
 
                 // Now check to see if there's a default and it matches the
                 // incoming call arg
-                if (($hasDefault && $hasArg) && $kargs[$arg] == $this->defaults[$arg] && !$gaps) {
+                if (($hasDefault && $hasArg) && $kargs[$arg] === $this->defaults[$arg] && !$gaps) {
                     continue;
                 }
 
diff --git a/framework/Routes/test/Horde/Routes/GenerationTest.php b/framework/Routes/test/Horde/Routes/GenerationTest.php
index 92ba3e7..6121df0 100644
--- a/framework/Routes/test/Horde/Routes/GenerationTest.php
+++ b/framework/Routes/test/Horde/Routes/GenerationTest.php
@@ -555,6 +555,8 @@ class GenerationTest extends PHPUnit_Framework_TestCase
                             $m->generate(array('controller' => 'content', 'action' => 'show_page', 'id' => '1')));
         $this->assertEquals('/page/10',
                             $m->generate(array('controller' => 'content', 'action' => 'show_page', 'id' => 10)));
+        $this->assertEquals('/page/0',
+                            $m->generate(array('controller' => 'content', 'action' => 'show_page', 'id' => 0)));
         $this->assertEquals('/blog/show/4',
                             $m->generate(array('controller' => 'blog', 'action' => 'show', 'id' => 4)));
         $this->assertEquals('/page',
@@ -982,4 +984,15 @@ class GenerationTest extends PHPUnit_Framework_TestCase
                                                                      'id'     => '1'))));
     }
 
+    public function testEmptyId()
+    {
+        $m = new Horde_Routes_Mapper();
+        $m->connect(':controller/:action/:id', array('controller' => 'content', 'action' => 'view'));
+
+        $this->assertEquals('/content/view/x',
+                            $m->generate(array('controller' => 'content', 'action' => 'view', 'id' => 'x')));
+        $this->assertEquals('/content/view/0',
+                            $m->generate(array('controller' => 'content', 'action' => 'view', 'id' => 0)));
+    }
+
 }