Commit 92a674e5 authored by alexpott's avatar alexpott

Issue #1890536 by chx, jibran: Update core pregs to use ?<name> for subpatterns instead of ?P<>.

parent bda47427
......@@ -126,7 +126,7 @@ function drupal_get_schema_versions($module) {
}
// Prepare regular expression to match all possible defined hook_update_N().
$regexp = '/^(?P<module>.+)_update_(?P<version>\d+)$/';
$regexp = '/^(?<module>.+)_update_(?<version>\d+)$/';
$functions = get_defined_functions();
// Narrow this down to functions ending with an integer, since all
// hook_update_N() functions end this way, and there are other
......
......@@ -489,12 +489,12 @@ protected function getImplementationInfo($hook) {
protected function parseDependency($dependency) {
// We use named subpatterns and support every op that version_compare
// supports. Also, op is optional and defaults to equals.
$p_op = '(?P<operation>!=|==|=|<|<=|>|>=|<>)?';
$p_op = '(?<operation>!=|==|=|<|<=|>|>=|<>)?';
// Core version is always optional: 8.x-2.x and 2.x is treated the same.
$p_core = '(?:' . preg_quote(DRUPAL_CORE_COMPATIBILITY) . '-)?';
$p_major = '(?P<major>\d+)';
$p_major = '(?<major>\d+)';
// By setting the minor version to x, branches can be matched.
$p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
$p_minor = '(?<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
$value = array();
$parts = explode('(', $dependency, 2);
$value['name'] = trim($parts[0]);
......
......@@ -1642,7 +1642,7 @@ protected function checkForMetaRefresh() {
if (!empty($refresh)) {
// Parse the content attribute of the meta tag for the format:
// "[delay]: URL=[page_to_redirect_to]".
if (preg_match('/\d+;\s*URL=(?P<url>.*)/i', $refresh[0]['content'], $match)) {
if (preg_match('/\d+;\s*URL=(?<url>.*)/i', $refresh[0]['content'], $match)) {
return $this->drupalGet($this->getAbsoluteUrl(decode_entities($match['url'])));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment