function FilterUnitTestCase::filterUrlWithPcreErrors

Calls filter_url with pcre.backtrack_limit set to 1.

When PCRE errors occur, _filter_url() returns the input text unchanged.

Parameters

$input: Text to pass on to _filter_url().

$filter: Filter to pass on to _filter_url().

Return value

The processed $input.

1 call to FilterUnitTestCase::filterUrlWithPcreErrors()
FilterUnitTestCase::testUrlFilterContent in modules/filter/filter.test
Tests URL filter on longer content.

File

modules/filter/filter.test, line 1917

Class

FilterUnitTestCase
Unit tests for core filters.

Code

protected function filterUrlWithPcreErrors($input, $filter) {
    $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);
    $result = _filter_url($input, $filter);
    ini_set('pcre.backtrack_limit', $pcre_backtrack_limit);
    return $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.