summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGábor Hojtsy2012-01-23 12:50:22 (GMT)
committer Gábor Hojtsy2012-01-23 12:50:22 (GMT)
commitae71f5d4d1a46ed7709abfd554519a6b7897f212 (patch)
tree5c17a1fd0adf36932515f044f74df77e5e195d0f
parent4d9234f4b1ade67170cb8459b76710f05ce48293 (diff)
Issue #883038 by pillarsdotnet, ShutterFreak, anarcat: ereg() and ereg_replace() are deprecated but Drupal 6 will not migrate to preg to avoid breaking APIs, so we need to silence the warnings coming out of the use of ereg on PHP 5.3+
-rw-r--r--includes/file.inc4
-rw-r--r--includes/unicode.inc4
2 files changed, 4 insertions, 4 deletions
diff --git a/includes/file.inc b/includes/file.inc
index b14c5b9..bbcf9dc 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -683,7 +683,7 @@ function file_validate_extensions($file, $extensions) {
// Bypass validation for uid = 1.
if ($user->uid != 1) {
- $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
+ $regex = '/\.('. @ereg_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));
}
@@ -967,7 +967,7 @@ function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $ca
// Give priority to files in this folder by merging them in after any subdirectory files.
$files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
}
- elseif ($depth >= $min_depth && ereg($mask, $file)) {
+ elseif ($depth >= $min_depth && @ereg($mask, $file)) {
// Always use this match over anything already set in $files with the same $$key.
$filename = "$dir/$file";
$basename = basename($file);
diff --git a/includes/unicode.inc b/includes/unicode.inc
index 228981b..b1ce757 100644
--- a/includes/unicode.inc
+++ b/includes/unicode.inc
@@ -134,7 +134,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 && @ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) {
$encoding = $match[1];
}
@@ -144,7 +144,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 = @ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out);
}
else {
watchdog('php', 'Could not convert XML encoding %s to UTF-8.', array('%s' => $encoding), WATCHDOG_WARNING);