OSTicket is a decent piece of software for customer service. I upgraded to PHP 5.3 and had some problems because they are trying to keep it working all the way back to PHP 4. 🙁
Here is a patch to fix the eregi_replace deprecated errors.
diff --git a/osticket/include/class.format.php b/osticket/include/class.format.php index 6cbb414..0380268 100644 --- a/osticket/include/class.format.php +++ b/osticket/include/class.format.php @@ -78,10 +78,10 @@ class Format { //make urls clickable. Mainly for display function clickableurls($text) { - $text=eregi_replace('(((f|ht){1}tp(s?)://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $text); - $text=eregi_replace("(^|[ \n\r\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(/[^/ \n\r]*)*)", + $text=preg_replace('#(((f|ht){1}tp(s?)://)[-a-zA-Z0-9@:%_\+.~\#?&//=]+)#','\\1', $text); + $text=preg_replace("#(^|[ \n\r\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(/[^/ \n\r]*)*)#", '\\1\\2', $text); - $text=eregi_replace("(^|[ \n\r\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})",'\\1\\2', $text); + $text=preg_replace("#(^|[ \n\r\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})#",'\\1\\2', $text); return $text; }
diff --git a/osticket/include/class.validator.php b/osticket/include/class.validator.php index 284d7c7..697d99c 100644 --- a/osticket/include/class.validator.php +++ b/osticket/include/class.validator.php @@ -126,15 +126,15 @@ class Validator { /* Functione below can be called directly without class instance. Validator::func(var..); */ function is_email($email) { - return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$",trim($email)); + return preg_match("#^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$#",trim($email)); } function is_phone($phone) { - $stripped=eregi_replace("(\(|\)|\-|\+)","",ereg_replace("([ ]+)","",$phone)); + $stripped=preg_replace("#(\(|\)|\-|\+)","",preg_replace("/([ ]+)#/","",$phone)); return (!is_numeric($stripped) || ((strlen($stripped)<7) || (strlen($stripped)>13)))?false:true; } function is_url($url) { //Thanks to 4ice for the fix. - $urlregex = "^(https?)\:\/\/"; + $urlregex = "#^(https?)\:\/\/"; // USER AND PASS (optional) $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; // HOSTNAME OR IP @@ -149,9 +149,9 @@ class Validator { // GET Query (optional) $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?"; // ANCHOR (optional) - $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?\$"; + $urlregex .= "(\#[a-z_.-][a-z0-9+\$_.-]*)?\$#"; - return eregi($urlregex, $url)?true:false; + return preg_match($urlregex, $url)?true:false; } @@ -161,7 +161,7 @@ class Validator { return false; $ip=trim($ip); - if(ereg("^[0-9]{1,3}(.[0-9]{1,3}){3}$",$ip)) { + if(preg_match("#^[0-9]{1,3}(.[0-9]{1,3}){3}$#",$ip)) { foreach(explode(".", $ip) as $block) if($block<0 || $block>255 ) return false;