Issue Details (XML | Word | Printable)

Key: MDL-10155
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Petr Skoda
Reporter: Martin Dougiamas
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

detect failed regexes duing multilang upgrade

Created: 18/Jun/07 04:49 PM   Updated: 05/Feb/08 06:31 AM
Return to search
Component/s: Filters
Affects Version/s: 1.8.1
Fix Version/s: 1.8.2, 1.9

File Attachments: 1. Text File multilang_regex.patch (4 kB)


Participants: Martin Dougiamas, Penny Leach, Peter Bulmer and Petr Skoda
Security Level: None
Resolved date: 05/Feb/08
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
(The same issue affects the multilang filter itself).

This seemed to make it work:

Index: multilangupgrade.php
===================================================================
RCS file: /cvsroot/moodle/moodle/admin/multilangupgrade.php,v
retrieving revision 1.4
diff -c -r1.4 multilangupgrade.php
*** multilangupgrade.php 15 Jun 2007 06:08:51 -0000 1.4
--- multilangupgrade.php 18 Jun 2007 08:41:03 -0000
***************
*** 59,65 ****
                  if ($rs and $rs->RecordCount() > 0) {
                      while (!$rs->EOF) {
                          $text = $rs->fields[$column];
! $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
                          $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
                          if ($newtext != $text) {
                              $newtext = addslashes($newtext);
--- 59,65 ----
                  if ($rs and $rs->RecordCount() > 0) {
                      while (!$rs->EOF) {
                          $text = $rs->fields[$column];
! $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)/is';
                          $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
                          if ($newtext != $text) {
                              $newtext = addslashes($newtext);



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Penny Leach added a comment - 19/Jun/07 04:36 AM
To reproduce the problem (using a simple example) - this should get modified and doesn't:

http://pastebin.ca/573484

To reproduce the problem (using a complicated example) - this should get modified but all data is lost:

http://pastebin.ca/575006


Penny Leach added a comment - 19/Jun/07 04:38 AM
I should say, martin's fix ^^^ appears to solve both problems.

Petr Skoda added a comment - 19/Jun/07 05:55 AM
here is a patch that should solve it,
please test it

the multilang use is not correct in the sample text, the conversion will work only partially, but it should not "eat" the text anymore


Penny Leach added a comment - 19/Jun/07 06:23 AM
The patch works for me, at least it doesn't eat the text.

I can't testify to its behaviour on valid blocks though.


Petr Skoda added a comment - 20/Jun/07 01:27 AM
fixed in cvs

Peter Bulmer added a comment - 13/Oct/07 07:35 AM
I'm seeing an issue where parts the text are eaten - not the whole thing.

The portion of text that goes missing ends mid-word, (aligned with a change in lang)

The site in question has just been upgraded from 1.5 & is undergoing the multilang upgrade.

For the full details, see
http://paste.dollyfish.net.nz/618ed2
becomes:
http://paste.dollyfish.net.nz/baa9df


Penny Leach added a comment - 13/Oct/07 07:36 AM
Reopening because of Pete Bulmer's comment

Petr Skoda added a comment - 05/Feb/08 06:31 AM
reclosing,
sorry - nested spans are not supported, there must be only language specified (no extra css style) and the spans can not be nested.

I hope we will change the multilang syntax after switching to some better htm leditor