From 2698b400628f2f1c4c0fa7d3e84574eb249432e8 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Fri, 18 Mar 2011 17:56:05 -0400
Subject: [PATCH] Issue #883038 by ShutterFreak, Damien Tournoud, mikeytown2, pillarsdotnet, anarcat: suppress ereg deprecated messages on PHP 5.3.

---
 includes/file.inc              |    4 ++--
 includes/unicode.inc           |    8 ++++----
 modules/blogapi/blogapi.module |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/includes/file.inc b/includes/file.inc
index f563f41..f4f289b 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -668,7 +668,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));
     }
@@ -937,7 +937,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..0a67afb 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);
@@ -342,9 +342,9 @@ function decode_entities($text, $exclude = array()) {
   // Flip the exclude list so that we can do quick lookups later.
   $exclude = array_flip($exclude);
 
-  // Use a regexp to select all entities in one pass, to avoid decoding 
+  // Use a regexp to select all entities in one pass, to avoid decoding
   // double-escaped entities twice. The PREG_REPLACE_EVAL modifier 'e' is
-  // being used to allow for a callback (see 
+  // being used to allow for a callback (see
   // http://php.net/manual/en/reference.pcre.pattern.modifiers).
   return preg_replace('/&(#x?)?([A-Za-z0-9]+);/e', '_decode_entities("$1", "$2", "$0", $html_entities, $exclude)', $text);
 }
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 6781382..4171f36 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -688,9 +688,9 @@ function blogapi_validate_user($username, $password) {
  * For the blogger API, extract the node title from the contents field.
  */
 function blogapi_blogger_title(&$contents) {
-  if (eregi('<title>([^<]*)</title>', $contents, $title)) {
+  if (@eregi('<title>([^<]*)</title>', $contents, $title)) {
     $title = strip_tags($title[0]);
-    $contents = ereg_replace('<title>[^<]*</title>', '', $contents);
+    $contents = @ereg_replace('<title>[^<]*</title>', '', $contents);
   }
   else {
     list($title, $contents) = explode("\n", $contents, 2);
-- 
1.7.1

