skodak/moodle-mod_book — Issue #16: Backup encode_content_links does not cope with encoded &amp; in URLs
Author: skodak
Created: 2011-10-08 12:46:49+00:00
State: open

The encode_content_links function includes the following regular expression:

"/(".$base."\/mod\/book\/view.php?id\=)([0-9]+)&chapterid=([0-9]+)/"

This fails when the URL is written with &chapterid= (note for the purpose of this bug report, I've doubled-up the 'amp;' as otherwise it does not show in the browser properly).

This can be fixed by changing the regular expression to:

"/(".$base."\/mod\/book\/view.php?id\=)([0-9]+)(?:&|&)chapterid=([0-9]+)/"

(Again I have doubled-up the 'amp' to get it to appear on the bug report - I hope the fix is still clear anyway)

see http://tracker.moodle.org/browse/CONTRIB-3176