From d520dc7c0dd7d4f3055c1df649796609f21c6581 Mon Sep 17 00:00:00 2001
From: Pieter Frenssen <pieter@frenssen.be>
Date: Thu, 13 Sep 2012 21:59:35 +0200
Subject: [PATCH] Issue #1783704 by pfrenssen: Test that paths can be matched
 to large patterns in drupal_match_path().

---
 .../lib/Drupal/system/Tests/Path/MatchPathTest.php   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
index a5cbfee..5f6d675 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
@@ -128,4 +128,24 @@ class MatchPathTest extends WebTestBase {
       ),
     );
   }
+
+  /**
+   * Tests that paths can be matched to large patterns.
+   */
+  function testDrupalMatchPathLargePattern() {
+    // Create a large patterns string.
+    $patterns = array();
+    for ($i = 0 ; $i < 20000 ; $i++) {
+      $patterns[] = "node/$i";
+    }
+    $patterns = implode("\n", $patterns);
+
+    // Try a matching path.
+    $result = drupal_match_path('node/19999', $patterns);
+    $this->assertTrue($result, t('A matching path was found in a large patterns string.'));
+
+    // Try a non-matching path.
+    $result = drupal_match_path('node/20000', $patterns);
+    $this->assertFalse($result, t('A non-matching path was not found in a large patterns string.'));
+  }
 }
-- 
1.7.12

