// Get FilterUrl object.
$filter =
$this->filters
['filter_url'
];
$filter->
setConfiguration([ 'settings' =>
[ 'filter_url_length' => 496,
],
]);
$path = __DIR__ . '/../..';
$input =
file_get_contents($path . '/filter.url-input.txt'
);
$expected =
file_get_contents($path . '/filter.url-output.txt'
);
$result =
_filter_url($input,
$filter);
$this->
assertSame($expected,
$result, 'Complex HTML document was correctly processed.'
);
$pcre_backtrack_limit =
ini_get('pcre.backtrack_limit'
);
// Setting this limit to the smallest possible value should cause PCRE
// errors and break the various preg_* functions used by _filter_url().
ini_set('pcre.backtrack_limit', 1
);
// If PCRE errors occur, _filter_url() should return the exact same text.
// Case of a small and simple HTML document.
$input =
$expected = '<p>www.test.com</p>';
$result =
_filter_url($input,
$filter);