=== modified file 'includes/common.inc'
--- includes/common.inc	2008-10-12 16:50:20 +0000
+++ includes/common.inc	2008-10-12 16:51:48 +0000
@@ -1415,9 +1415,10 @@ function url($path = NULL, array $option
     $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
   }
 
-  if (function_exists('custom_url_rewrite_outbound')) {
+  foreach (module_implements('url_rewrite_outbound') as $module) {
     // Modules may alter outbound links by reference.
-    custom_url_rewrite_outbound($path, $options, $original_path);
+    $function = $module . '_url_rewrite_outbound';
+    $function($path, $options, $original_path);
   }
 
   $base = $options['absolute'] ? $options['base_url'] . '/' : base_path();

=== modified file 'includes/path.inc'
--- includes/path.inc	2008-10-12 16:50:20 +0000
+++ includes/path.inc	2008-10-12 16:51:48 +0000
@@ -130,9 +130,10 @@ function drupal_get_normal_path($path, $
   if ($src = drupal_lookup_path('source', $path, $path_language)) {
     $result = $src;
   }
-  if (function_exists('custom_url_rewrite_inbound')) {
+  foreach (module_implements('url_rewrite_inbound') as $module) {
     // Modules may alter the inbound request path by reference.
-    custom_url_rewrite_inbound($result, $path, $path_language);
+    $function = $module . '_url_rewrite_inbound';
+    $function($result, $path, $path_language);
   }
   return $result;
 }

=== added file 'modules/simpletest/tests/hook_url_rewrite.info'
--- modules/simpletest/tests/hook_url_rewrite.info	1970-01-01 00:00:00 +0000
+++ modules/simpletest/tests/hook_url_rewrite.info	2008-10-12 16:52:20 +0000
@@ -0,0 +1,8 @@
+; $Id$
+name = "Hook url_rewrite tests"
+description = "Support module for url_rewrite hook testing."
+package = Testing
+version = VERSION
+core = 7.x
+files[] = hook_url_rewrite.module
+hidden = TRUE

=== added file 'modules/simpletest/tests/hook_url_rewrite.module'
--- modules/simpletest/tests/hook_url_rewrite.module	1970-01-01 00:00:00 +0000
+++ modules/simpletest/tests/hook_url_rewrite.module	2008-10-12 16:52:20 +0000
@@ -0,0 +1,27 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Module to test hook_url_rewrite_inbound() and hook_url_rewrite_outbound().
+ */
+
+/**
+ * Implementation of hook_url_rewrite_inbound().
+ */
+function hook_url_rewrite_url_rewrite_inbound(&$result, $path, $path_language) {
+  // Rewrite member/* to user/*
+  if (preg_match('|^member(/.*)|', $path, $matches)) {
+    $result = 'user' . $matches[1];
+  }
+}
+
+/**
+ * Implementation of hook_url_rewrite_outbound().
+ */
+function hook_url_rewrite_url_rewrite_outbound(&$path, &$options, $original_path) {
+  // Rewrite user/* to member/*
+  if (preg_match('|^user(/.*)|', $path, $matches)) {
+    $path = 'member' . $matches[1];
+  }
+}

=== added file 'modules/simpletest/tests/path.test'
--- modules/simpletest/tests/path.test	1970-01-01 00:00:00 +0000
+++ modules/simpletest/tests/path.test	2008-10-12 16:52:24 +0000
@@ -0,0 +1,37 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Tests for path.inc
+ */
+
+class PathIncTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Path tests'),
+      'description' => t('Test path.inc functionality.'),
+      'group' => t('Path'),
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    // Enable dummy module that implements hook_url_rewrite_inbound and
+    // hook_url_rewrite_outbound.
+    parent::setUp('hook_url_rewrite');
+  }
+
+  /**
+   * Test url_rewrite hooks.
+   */
+  function testHookUrlRewrite() {
+    $this->drupalGet('member/password');
+    $this->assertText(t('Username or e-mail address:'));
+  }
+}

