]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2057 (broken internet archive links)
authorJeff Tilson <jrtilson@gmail.com>
Mon, 29 Apr 2013 17:38:42 +0000 (13:38 -0400)
committerJeff Tilson <jrtilson@gmail.com>
Mon, 29 Apr 2013 17:38:42 +0000 (13:38 -0400)
engine/lib/output.php
engine/tests/regression/trac_bugs.php

index 6905b9b7183162995f988bf5ccd94a07c260e5cb..5adc01053dde19f9f3bdc06d6904121cc8e7fb57 100644 (file)
@@ -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',
                '
index 4de9c306bf90d43e5af8cf6375bf8424414acff0..b791dcad3c9fd1ac68431f7d2059141a4cf946f5 100644 (file)
@@ -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));
+       }
 }