Typo in XML filter regex

Bug #1484296 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells
15.04
Fix Released
High
Aaron Wells
15.10
Fix Released
Undecided
Unassigned

Bug Description

A client reported this issue to me while testing the patch https://reviews.mahara.org/5062

They found that after that patch was in place ALL leap import/export operations produced this error:

"[WAR] export/leap/lib.php:161 preg_replace(): Compilation failed: non-hex character in \x{} (closing brace missing?) at offset 92"

On inspection in the code, it's obvious that there is indeed a syntax error in the regex that I wrote in patch https://reviews.mahara.org/5061. Specifically a missing closing brace. It says "\x{FDEO" where it should be "\x{FDEO}". Strangely the presence of this syntax error did not cause any problems when running this code on my local machine. I suspect it may be a difference in the version of the PCRE library that we're running.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/5088

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Since this syntax error didn't cause any errors in my local machine, I validated the regex against this external service, which did detect the error in the original regex: https://regex101.com/r/mD1fR2/1

Revision history for this message
Aaron Wells (u-aaronw) wrote :

It turns out the site that experienced the error was running PHP 5.5.12, while my machine is running PHP 5.5.9.

In 5.5.10 they updated the PCRE version from 8.31 to 8.34 ( http://php.net/ChangeLog-5.php#5.5.10 ). And in the release notes for PCRE 8.34 ( http://www.pcre.org/original/changelog.txt ), there's this: "23. Perl now gives an error for missing closing braces after \x{... instead of treating the string as literal. PCRE now does the same."

So that's the reason why the code did not cause any problems on my machine, but did cause problems on the other site.

It also probably means that the regex was not fully functional even if it wasn't giving out any errors. Probably the reason it worked for me was that my test data was using illegal characters in the ASCII range, which are at the start of the regex, before the part with the syntax error.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/5088
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/486c747e7a69282fcf24fe8ca3f5c4c9abf2f66a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 486c747e7a69282fcf24fe8ca3f5c4c9abf2f66a
Author: Aaron Wells <email address hidden>
Date: Thu Aug 13 11:08:50 2015 +1200

Typo in regex (bug 1484296)

Change-Id: Ic8810e0a46c690a7c0afe438950ca2e263504dfd
behatnotneeded: Currently can't test leap2a import/export in Behat

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/5094

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/5094
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/8db3829d9a6142ffece84b010a471a3ecf31085f
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 8db3829d9a6142ffece84b010a471a3ecf31085f
Author: Aaron Wells <email address hidden>
Date: Thu Aug 13 11:08:50 2015 +1200

Typo in regex (bug 1484296)

Change-Id: Ic8810e0a46c690a7c0afe438950ca2e263504dfd
behatnotneeded: Currently can't test leap2a import/export in Behat
(cherry picked from commit 486c747e7a69282fcf24fe8ca3f5c4c9abf2f66a)

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/5140

Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.