Skip to content
Snippets Groups Projects
Commit c89f8ac9 authored by Uma's avatar Uma
Browse files

Fixes #1178 split api is replaced with preg_split

parent bec7ba8c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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) {} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment