diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-09-05 09:25:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-09-05 09:25:52 +0000 |
commit | 2b0766503392aaf91837b64ca6a0a3c6d2f035ce (patch) | |
tree | 0f22a3b443809d12fe13b563b615ed7a0e0df0f5 /includes | |
parent | 4231e3e98ba477e34a424bbc2e766e6f3ba42411 (diff) | |
download | brdo-2b0766503392aaf91837b64ca6a0a3c6d2f035ce.tar.gz brdo-2b0766503392aaf91837b64ca6a0a3c6d2f035ce.tar.bz2 |
- Patch #64967 by Arancaytar, meba: ereg -> preg for performance reasons and future compatilbility. PHP6 is rumoured to drop ereg support.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/database/select.inc | 4 | ||||
-rw-r--r-- | includes/file.inc | 2 | ||||
-rw-r--r-- | includes/unicode.inc | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/includes/database/select.inc b/includes/database/select.inc index 3d1074773..e24b54cc2 100644 --- a/includes/database/select.inc +++ b/includes/database/select.inc @@ -670,9 +670,11 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab // ORDER BY if ($this->order) { $query .= "\nORDER BY "; + $fields = array(); foreach ($this->order as $field => $direction) { - $query .= $field . ' ' . $direction . ' '; + $fields[] = $field . ' ' . $direction; } + $query .= implode(', ', $fields); } // RANGE is database specific, so we can't do it here. diff --git a/includes/file.inc b/includes/file.inc index 68fa2c23b..1be451823 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -658,7 +658,7 @@ function file_validate_extensions($file, $extensions) { // Bypass validation for uid = 1. if ($user->uid != 1) { - $regex = '/\.(' . ereg_replace(' +', '|', preg_quote($extensions)) . ')$/i'; + $regex = '/\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i'; if (!preg_match($regex, $file->filename)) { $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions)); } diff --git a/includes/unicode.inc b/includes/unicode.inc index 93a522d09..b01e3bcfd 100644 --- a/includes/unicode.inc +++ b/includes/unicode.inc @@ -135,7 +135,7 @@ function drupal_xml_parser_create(&$data) { } // Check for an encoding declaration in the XML prolog if no BOM was found. - if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) { + if (!$bom && preg_match('/^<\?xml[^>]+encoding="(.+?)"/', $data, $match)) { $encoding = $match[1]; } @@ -145,7 +145,7 @@ function drupal_xml_parser_create(&$data) { $out = drupal_convert_to_utf8($data, $encoding); if ($out !== FALSE) { $encoding = 'utf-8'; - $data = ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out); + $data = preg_replace('/^(<\?xml[^>]+encoding)="(.+?)"/', '\\1="utf-8"', $out); } else { watchdog('php', 'Could not convert XML encoding %s to UTF-8.', array('%s' => $encoding), WATCHDOG_WARNING); |