From c89f8ac97f3d03206f53852f6efd3d2de77ce8fb Mon Sep 17 00:00:00 2001
From: Uma <uma.s@vtiger.com>
Date: Fri, 11 Oct 2019 11:36:23 +0530
Subject: [PATCH] Fixes #1178 split api is replaced with preg_split

---
 include/utils/VtlibUtils.php |  7 +++++++
 include/utils/utils.php      | 27 ---------------------------
 2 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php
index 3a198fe23..9f8ba17d2 100644
--- a/include/utils/VtlibUtils.php
+++ b/include/utils/VtlibUtils.php
@@ -839,4 +839,11 @@ if (!function_exists('split')) {
 
 }
 
+function php7_compat_ereg($pattern, $str, $ignore_case=false) {
+	$regex = '/'. preg_replace('/\//', '\\/', $pattern) .'/' . ($ignore_case ? 'i': '');
+	return preg_match($regex, $str);
+}
+
+if (!function_exists('ereg')) { function ereg($pattern, $str) { return php7_compat_ereg($pattern, $str); } }
+if (!function_exists('eregi')) { function eregi($pattern, $str) { return php7_compat_ereg($pattern, $str, true); } }
 ?>
\ No newline at end of file
diff --git a/include/utils/utils.php b/include/utils/utils.php
index fc250c377..1ccbf5d6d 100755
--- a/include/utils/utils.php
+++ b/include/utils/utils.php
@@ -2322,33 +2322,6 @@ function lower_array(&$string){
 	$string = strtolower(trim($string));
 }
 
-/* PHP 7 support */
-function php7_compat_split($delim, $str, $ignore_case=false) {
-	$splits = array();
-	while ($str) {
-		$pos = $ignore_case ? stripos($str, $delim) : strpos($str, $delim);
-		if ($pos !== false) {
-			$splits[] = substr($str, 0, $pos);
-			$str = substr($str, $pos + strlen($delim));
-		} else {
-			$splits[] = $str;
-			$str = false;
-		}
-	}
-	return $splits;
-}
-
-if (!function_exists('split'))  { function split($delim, $str)  {return php7_compat_split($delim, $str); } }
-if (!function_exists('spliti')) { function spliti($delim, $str) {return php7_compat_split($delim, $str, true);}}
-
-function php7_compat_ereg($pattern, $str, $ignore_case=false) {
-	$regex = '/'. preg_replace('/\//', '\\/', $pattern) .'/' . ($ignore_case ? 'i': '');
-	return preg_match($regex, $str);
-}
-
-if (!function_exists('ereg')) { function ereg($pattern, $str) { return php7_compat_ereg($pattern, $str); } }
-if (!function_exists('eregi')) { function eregi($pattern, $str) { return php7_compat_ereg($pattern, $str, true); } }
-
 if (!function_exists('get_magic_quotes_runtime')) { function get_magic_quotes_runtime() { return false; } }
 if (!function_exists('set_magic_quotes_runtime')) { function set_magic_quotes_runtime($flag) {} }
 
-- 
GitLab