jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 10
Total Residents: 491
Online Now: 0
Hypergriders online: 0

mysql_real_escape_string not available in PHP 7

8 years 9 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 to join the conversation.

8 years 9 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 to join the conversation.

8 years 9 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 to join the conversation.

8 years 7 months 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 to join the conversation.

Time to create page: 0.071 seconds