-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
Future Dev
-
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
- duplicates
-
MDL-19071 Look for working unicode regex in environmental checks
-
- Closed
-