Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32629

Environment checks should require preg unicode support


    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: Future Dev
    • Fix Version/s: None
    • Component/s: Installation
    • Labels:


      Code such as this test script:

      ini_set('display_errors', 1);
      $silly = preg_replace('~a~u', 'b', 'abc');
      print htmlspecialchars(print_r($silly, true));

      can fail on some servers with an error such as 'Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown option bit(s) set at offset -1' because PHP is using a version of the PCRE library that doesn't support Unicode. I have had this reported on CentOS 5.5. This link suggests that the only solution on those platforms is to use a custom-built PHP package: http://stackoverflow.com/questions/7456939/what-is-the-preg-match-all-u-flag-dependent-on

      If possible it would be nice to add this to the environment checks for Moodle 2.4. Otherwise we need to make sure that we don't use the 'u' regex modifier (in core or contrib code) without specifically checking for the error. (Note: I think it returns null in this case.)

      I'm looking for opinions on as to whether this is a good idea, before doing anything

        Gliffy Diagrams

          Issue Links


            There are no comments yet on this issue.


              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: