jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 12
Total Residents: 485
Online Now: 1
Hypergriders online: 0

mysql_real_escape_string not available in PHP 7

8 years 3 months ago #2453 by dgbaker
Hey, so it would seem we broke jOpenSim by trying to use PHP 7.

The mysql_real_escape_string is no longer available in PHP 7 causing undefined function calls in jOpenSim.

Here is the entire error message;
11:19:48 - [jOpenSimProfile]: HandleAvatarClassifiedsRequest for 4660d5c8-a589-11e4-9866-00163e007790
11:19:48 - [jOpenSimProfile]: GenericXMLRPCRequest for method avatarclassifiedsrequest
11:19:49 - [jOpenSimProfile]: Unable to connect to Profile Server http://chimerazone.com/components/com_opensim/interface.php.  Exception System.Net.WebException: The remote server returned an error: (500) Call to undefined function mysql_real_escape_string().
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) <0x41ca1410 + 0x00193> in <filename unknown>:0
  at System.Net.HttpWebRequest.GetResponse () <0x41c9d300 + 0x00053> in <filename unknown>:0
  at Nwc.XmlRpc.XmlRpcRequest.Send (System.String url, Int32 timeout) <0x41dd0570 + 0x00239> in <filename unknown>:0
  at jOpenSim.Profile.jOpenProfile.OpenProfileModule.GenericXMLRPCRequest (System.Collections.Hashtable ReqParams, System.String method) <0x45d28000 + 0x00153> in <filename unknown>:0
11:19:49 - [jOpenSimProfile]: RequestAvatarProperties for 4660d5c8-a589-11e4-9866-00163e007790
11:19:49 - [jOpenSimProfile]: GetProfileData for 4660d5c8-a589-11e4-9866-00163e007790
11:19:49 - [jOpenSimProfile]: GenericXMLRPCRequest for method avatar_properties_request
11:19:49 - [jOpenSimProfile]: Unable to connect to Profile Server http://chimerazone.com/components/com_opensim/interface.php.  Exception System.Net.WebException: The remote server returned an error: (500) Call to undefined function mysql_real_escape_string().
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) <0x41ca1410 + 0x00193> in <filename unknown>:0
  at System.Net.HttpWebRequest.GetResponse () <0x41c9d300 + 0x00053> in <filename unknown>:0
  at Nwc.XmlRpc.XmlRpcRequest.Send (System.String url, Int32 timeout) <0x41dd0570 + 0x00239> in <filename unknown>:0
  at jOpenSim.Profile.jOpenProfile.OpenProfileModule.GenericXMLRPCRequest (System.Collections.Hashtable ReqParams, System.String method) <0x45d28000 + 0x00153> in <filename unknown>:0
11:19:49 - [jOpenSimProfile]: received Data:
11:19:49 - [jOpenSimProfile]: [avatarID]: 4660d5c8-a589-11e4-9866-00163e007790
11:19:49 - [jOpenSimProfile]: profileData[AboutText]:
11:19:49 - [jOpenSimProfile]: [Created]: 1/26/2015
11:19:49 - [jOpenSimProfile]: [charterMember]: System.Byte[]
11:19:49 - [jOpenSimProfile]: profileData[firstLifeAboutText]:
11:19:49 - [jOpenSimProfile]: [UserFlags]: 12
11:19:49 - [jOpenSimProfile]: profileData[firstLifeImage]: 00000000-0000-0000-0000-000000000000
11:19:49 - [jOpenSimProfile]: profileData[image]: 00000000-0000-0000-0000-000000000000
11:19:49 - [jOpenSimProfile]: profileData[profileUrl]:
11:19:49 - [jOpenSimProfile]: profileData[partner]: 00000000-0000-0000-0000-000000000000

What I am looking for is a simple way to replace that function and was wondering if you think the following would work as a quick temporary workaround.
function mysqlsafestring($string) {
//      return mysql_real_escape_string(stripslashes($string));

if(is_array($string))
        return array_map(__METHOD__, $string);

    if(!empty($inp) && is_string($string)) {
        return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $string);
    }

    return $string;
}

This would replace the function in interface.php, currency.php and map.php

Thoughts?

Cheers!
Dave

Please Log in or Create an account to join the conversation.

8 years 3 months ago #2454 by dgbaker
ok scrap that idea, that function is used everywhere in com_opensim/includes

Anyone got any thoughts other than downgrading PHP?

Please Log in or Create an account to join the conversation.

8 years 3 months ago #2455 by dgbaker
Did a quick search and replace of:

mysql_real_escape_string to mysqli_real_escape_string

So far no more error. 63 replacements though in com_opensim module.

Please Log in or Create an account to join the conversation.

8 years 1 month ago #2473 by Roaming
sorry to say stay away from php7 for a while there are all kinds of issues and its not just with this project

Please Log in or Create an account to join the conversation.

Time to create page: 0.094 seconds

Search

Donate jOpenSim

Please consider supporting our efforts.

Amount

Our Regions

Region: Loc X: Loc Y:
Agora 1000 998
BareBad… 997 997
Bohemas 996 998
BoraBor… 1002 999
Crystal… 1001 1000
DeepTho… 1005 998
FoToSan… 999 995
jCity 1001 997
jOpenWe… 1000 999
JuniorT… 1002 1001
Kanadah… 1002 1000
LindaKe… 1000 997
LittleC… 996 997
MonteSc… 1001 1001
Naos 999 999
Pangaea 1005 1003
RiverSi… 999 1000
Sakani 999 998
Snambin 1001 998
Tartola 997 998
ViewerH… 1002 998
WaterWo… 1001 999
WilderK… 1000 1000

jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 12
Total Residents: 485
Online Now: 1
Hypergriders online: 0