aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Tilson <jrtilson@gmail.com>2013-04-29 13:38:42 -0400
committerJeff Tilson <jrtilson@gmail.com>2013-04-29 13:38:42 -0400
commitcd7922c58f3f2d04b8ca4bcf336ecda2787c821e (patch)
treed28191d8dd17fce4d307a290c1c2cf1168a98d1d
parent11c8b773274e3e7217eb7e842448ceb592541c63 (diff)
downloadelgg-cd7922c58f3f2d04b8ca4bcf336ecda2787c821e.tar.gz
elgg-cd7922c58f3f2d04b8ca4bcf336ecda2787c821e.tar.bz2
Fixes #2057 (broken internet archive links)
-rw-r--r--engine/lib/output.php2
-rw-r--r--engine/tests/regression/trac_bugs.php9
2 files changed, 10 insertions, 1 deletions
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 6905b9b71..5adc01053 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -27,7 +27,7 @@ function parse_urls($text) {
// By default htmlawed rewrites tags to this format.
// if PHP supported conditional negative lookbehinds we could use this:
// $r = preg_replace_callback('/(?<!=)(?<![ ])?(?<!["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\),]+)/i',
- $r = preg_replace_callback('/(?<!=)(?<!["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\(\)]+)/i',
+ $r = preg_replace_callback('/(?<![=\/"\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\(\)]+)/i',
create_function(
'$matches',
'
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 4de9c306b..b791dcad3 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -288,4 +288,13 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
$this->assertEqual($output, parse_urls($input));
}
}
+
+ /**
+ * Test #2057 -- parse_urls()
+ * https://github.com/Elgg/Elgg/issues/2057
+ */
+ public function test_archive_url() {
+ $input = '<a href="http://web.archive.org/web/20000229040250/http://www.google.com/">google</a>';
+ $this->assertEqual($input, parse_urls($input));
+ }
}