Deprecated Errors

Ask all your questions about the script here.
Josh
Site Admin
Posts: 372
Joined: Mon Nov 05, 2007 7:30 pm
Location: California
Contact:

Deprecated Errors

Postby Josh » Sat Feb 20, 2010 10:27 am

Quadodo was originally written to support the 4.x branch of PHP, years ago. :P

Well, today web hosts and servers like WAMP are by default installing version 5.3 of PHP. Unfortunately, a newer version of Quadodo hasn't been released in the past year to comply with the changes. Therefore, two solutions exist to fix the errors.

The first solution is the easiest: downgrade your PHP version. If possible, you would just have to ask your web host to use version 5.1.x or 5.2.x or you'd manually do it if you have access to the root.

Otherwise, you're forced to change every instance of the deprecated functions to supported functions before you install. Below I have made a list of all the places to change...

First, find this line in install/Install.class.php (on line 52).

Code: Select all

$this->main_directory = ereg_replace('/install', '', $this->install_directory);

And replace it with this...

Code: Select all

$this->main_directory = preg_replace('/install/', '', $this->install_directory);


Second, find this line in includes/SQL.class.php (on line 60).

Code: Select all

$file_location = ereg_replace('/includes', '/install/', dirname(__FILE__));

And replace it with this...

Code: Select all

$file_location = preg_replace('/includes/', '/install/', dirname(__FILE__));


Third, find this line in includes/Admin.class.php (on line 146).

Code: Select all

$email = (isset($_GET['email']) && strlen($_GET['email']) > 6 && strlen($_GET['email']) < 256 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['email'])) ? $this->qls->Security->make_safe($_GET['email']) : false;

And replace it with this...

Code: Select all

$email = (isset($_GET['email']) && strlen($_GET['email']) > 6 && strlen($_GET['email']) < 256 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['email'])) ? $this->qls->Security->make_safe($_GET['email']) : false;


Fourth, find this line in includes/Admin.class.php (on line 323).

Code: Select all

$new_email = (isset($_GET['new_email']) && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['new_email'])) ? $this->qls->Security->make_safe($_GET['new_email']) : false;

And replace it with this...

Code: Select all

$new_email = (isset($_GET['new_email']) && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['new_email'])) ? $this->qls->Security->make_safe($_GET['new_email']) : false;


Then, find this line in includes/Admin.class.php (on line 1160).

Code: Select all

$to = (isset($_GET['to']) && strlen($_GET['to']) > 6 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['to'])) ? $_GET['to'] : false;

And replace it with this...

Code: Select all

$to = (isset($_GET['to']) && strlen($_GET['to']) > 6 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['to'])) ? $_GET['to'] : false;


Then, find this line in includes/Admin.class.php (on line 1161).

Code: Select all

$reply_to = (isset($_GET['reply_to']) && strlen($_GET['reply_to']) > 6 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['reply_to'])) ? $_GET['reply_to'] : false;

And replace it with this...

Code: Select all

$reply_to = (isset($_GET['reply_to']) && strlen($_GET['reply_to']) > 6 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['reply_to'])) ? $_GET['reply_to'] : false;


Finally, find this line in includes/User.class.php (on line 664).

Code: Select all

$email = (isset($_POST['email']) && strlen($_POST['email']) > 6 && strlen($_POST['email']) < 256 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_POST['email'])) ? $this->qls->Security->make_safe($_POST['email']) : false;

And replace it with this...

Code: Select all

$email = (isset($_POST['email']) && strlen($_POST['email']) > 6 && strlen($_POST['email']) < 256 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_POST['email'])) ? $this->qls->Security->make_safe($_POST['email']) : false;


Great! :D If there are any more compatibility issues that anyone finds, please post them below so I can add them to this guide.

Thanks for reading!
kivieg
User
Posts: 21
Joined: Thu Jun 25, 2009 10:39 pm

Re: Deprecated Errors

Postby kivieg » Sat Jun 19, 2010 9:47 am

I made all of these changes and am still getting:

mysqlnd cannot connect to MySQL 4.1+ using old authentication


I am using WAMP:
MySQL Version : 5.1.36
PHP Version : 5.3.0

thanks,
joel
kivieg
User
Posts: 21
Joined: Thu Jun 25, 2009 10:39 pm

Re: Deprecated Errors

Postby kivieg » Sun Jun 20, 2010 4:31 pm

Answered this on my own. Turns out that PHP 5.3 introduces some incompatabilities, including a higher security requirement for connecting to MySQL. Reverting back to PHP 5.2 solved the problem...

joel
crystaltears83
New
Posts: 1
Joined: Wed Jun 06, 2012 8:22 am

Re: Deprecated Errors

Postby crystaltears83 » Wed Jun 06, 2012 8:43 am

I don't know if you're still around but I did these changes and still end up with:

Deprecated: Function eregi() is deprecated in /home/crystalt/public_html/usr/install/Install.class.php on line 283


But line 283 wasn't in your fix :P
Sof
New
Posts: 1
Joined: Wed Aug 22, 2012 8:28 am

Re: Deprecated Errors

Postby Sof » Wed Aug 22, 2012 8:36 am

Josh wrote:Quadodo was originally written to support the 4.x branch of PHP, years ago. :P

Well, today web hosts and servers like WAMP are by default installing version 5.3 of PHP. Unfortunately, a newer version of Quadodo hasn't been released in the past year to comply with the changes. Therefore, two solutions exist to fix the errors.

The first solution is the easiest: downgrade your PHP version. If possible, you would just have to ask your web host to use version 5.1.x or 5.2.x or you'd manually do it if you have access to the root.

Otherwise, you're forced to change every instance of the deprecated functions to supported functions before you install. Below I have made a list of all the places to change...

First, find this line in install/Install.class.php (on line 52).

Code: Select all

$this->main_directory = ereg_replace('/install', '', $this->install_directory);

And replace it with this...

Code: Select all

$this->main_directory = preg_replace('/install/', '', $this->install_directory);


Second, find this line in includes/SQL.class.php (on line 60).

Code: Select all

$file_location = ereg_replace('/includes', '/install/', dirname(__FILE__));

And replace it with this...

Code: Select all

$file_location = preg_replace('/includes/', '/install/', dirname(__FILE__));


Third, find this line in includes/Admin.class.php (on line 146).

Code: Select all

$email = (isset($_GET['email']) && strlen($_GET['email']) > 6 && strlen($_GET['email']) < 256 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['email'])) ? $this->qls->Security->make_safe($_GET['email']) : false;

And replace it with this...

Code: Select all

$email = (isset($_GET['email']) && strlen($_GET['email']) > 6 && strlen($_GET['email']) < 256 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['email'])) ? $this->qls->Security->make_safe($_GET['email']) : false;


Fourth, find this line in includes/Admin.class.php (on line 323).

Code: Select all

$new_email = (isset($_GET['new_email']) && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['new_email'])) ? $this->qls->Security->make_safe($_GET['new_email']) : false;

And replace it with this...

Code: Select all

$new_email = (isset($_GET['new_email']) && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['new_email'])) ? $this->qls->Security->make_safe($_GET['new_email']) : false;


Then, find this line in includes/Admin.class.php (on line 1160).

Code: Select all

$to = (isset($_GET['to']) && strlen($_GET['to']) > 6 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['to'])) ? $_GET['to'] : false;

And replace it with this...

Code: Select all

$to = (isset($_GET['to']) && strlen($_GET['to']) > 6 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['to'])) ? $_GET['to'] : false;


Then, find this line in includes/Admin.class.php (on line 1161).

Code: Select all

$reply_to = (isset($_GET['reply_to']) && strlen($_GET['reply_to']) > 6 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_GET['reply_to'])) ? $_GET['reply_to'] : false;

And replace it with this...

Code: Select all

$reply_to = (isset($_GET['reply_to']) && strlen($_GET['reply_to']) > 6 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_GET['reply_to'])) ? $_GET['reply_to'] : false;


Finally, find this line in includes/User.class.php (on line 664).

Code: Select all

$email = (isset($_POST['email']) && strlen($_POST['email']) > 6 && strlen($_POST['email']) < 256 && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', $_POST['email'])) ? $this->qls->Security->make_safe($_POST['email']) : false;

And replace it with this...

Code: Select all

$email = (isset($_POST['email']) && strlen($_POST['email']) > 6 && strlen($_POST['email']) < 256 && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i', $_POST['email'])) ? $this->qls->Security->make_safe($_POST['email']) : false;


Great! :D If there are any more compatibility issues that anyone finds, please post them below so I can add them to this guide.

Thanks for reading!


To fix the Deprecated: Function eregi() is deprecated in Install.class.php on line 283 :
Find this line in install/Install.class.php (on line 283).

Code: Select all

$email = (isset($_POST['email']) && eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $_POST['email']) && strlen($_POST['email']) <= 255 && strlen($_POST['email']) > 6) ? $_POST['email'] : false;

And replace it with this...

Code: Select all

$email = (isset($_POST['email']) && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $_POST['email']) && strlen($_POST['email']) <= 255 && strlen($_POST['email']) > 6) ? $_POST['email'] : false;


thats all...
kivieg
User
Posts: 21
Joined: Thu Jun 25, 2009 10:39 pm

Re: Deprecated Errors

Postby kivieg » Fri Jul 19, 2013 3:46 pm

Just curious: any plans to update Quadodo so it works better with PHP 5.3+?
User avatar
chrisx84
Super User
Posts: 58
Joined: Fri Nov 16, 2007 9:04 am
Location: Hamilton, Ontario, Canada
Contact:

Re: Deprecated Errors

Postby chrisx84 » Fri Jul 19, 2013 4:34 pm

kivieg please search the forums as I have stated this afew times lately already. Thank you.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest