Permalink
Browse files

MDL-42582 Availability: Restriction display incorrect for multi-para …

…Labels

When a label has multiple paragraphs, its name (converted to plain text)
contains a line feed. Due to an error in regular expressions that don't
accept the line feed, this caused incorrect display on the course page
when that label is shown as a requirement for accessing another activity.
  • Loading branch information...
1 parent 67d4599 commit a55a5d28c229c0ce323b0a44dc0e50f1b8f06761 @sammarshallou sammarshallou committed Oct 29, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/conditionlib.php
View
4 lib/conditionlib.php
@@ -918,7 +918,7 @@ public function get_full_information($modinfo=null) {
if (!empty($information)) {
$li = strpos($information, '<li>', 4);
if ($li === false) {
- $information = preg_replace('~^<li>(.*)</li>$~', '$1', $information);
+ $information = preg_replace('~^\s*<li>(.*)</li>\s*$~s', '$1', $information);
} else {
$information = html_writer::tag('ul', $information);
}
@@ -1119,7 +1119,7 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin
if (!empty($information)) {
$li = strpos($information, '<li>', 4);
if ($li === false) {
- $information = preg_replace('~^<li>(.*)</li>$~', '$1', $information);
+ $information = preg_replace('~^\s*<li>(.*)</li>\s*$~s', '$1', $information);
} else {
$information = html_writer::tag('ul', $information);
}

0 comments on commit a55a5d2

Please sign in to comment.