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

Environment checks should require preg unicode support

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • Future Dev
    • Installation
    • None

      Code such as this test script:

      <?php
      ini_set('display_errors', 1);
      error_reporting(E_ALL);
      $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

            moodle.com Moodle HQ
            quen Sam Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.