mirror of
https://github.com/moodle/moodle.git
synced 2025-06-02 14:15:11 +02:00
MDL-60239 libraries: patch Markdown for PHP7.2
This commit is contained in:
parent
0b55f881f1
commit
2a1275479c
@ -1870,9 +1870,9 @@ class Markdown implements MarkdownInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->utf8_strlen = create_function('$text', 'return preg_match_all(
|
||||
"/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
|
||||
$text, $m);');
|
||||
$this->utf8_strlen = function($text) {
|
||||
return preg_match_all('/[\x00-\xBF]|[\xC0-\xFF][\x80-\xBF]*/', $text, $m);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,9 @@ Procedure:
|
||||
* copy the classes and readme file to lib/markdown/* , Note .inc files need not be copied.
|
||||
* update function markdown_to_html() in weblib.php if necessary,
|
||||
note that we require the php files manually for performance reasons
|
||||
* pull commits https://github.com/michelf/php-markdown/commit/0c1337a4d483b1e0b66bfdc3ffa644eafd40aa27
|
||||
and https://github.com/michelf/php-markdown/commit/251ffcce7582d4b26936679e340abca973d55220
|
||||
if they are not included in the next release (or remove this step)
|
||||
* run phpunit tests
|
||||
|
||||
Petr Skoda
|
||||
|
@ -63,4 +63,10 @@ class core_markdown_testcase extends basic_testcase {
|
||||
$result = "<p>some <a href=\"http://example.com/\">example link</a></p>\n";
|
||||
$this->assertSame($result, markdown_to_html($text));
|
||||
}
|
||||
|
||||
public function test_tabs() {
|
||||
$text = "a\tbb\tccc\tя\tюэ\t水\tabcd\tabcde\tabcdef";
|
||||
$result = "<p>a bb ccc я юэ 水 abcd abcde abcdef</p>\n";
|
||||
$this->assertSame($result, markdown_to_html($text));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user