*

Recent

Author Topic: Deprecated: Function ereg_replace()  (Read 8036 times)

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Deprecated: Function ereg_replace()
« on: February 01, 2012, 08:11:34 PM »
Getting loads of these errors. I believe i have followed the instructions to the letter but am still getting these errors, can anyone help.
E.g. Deprecated: Function ereg_replace() is deprecated in /home/harlowad/public_html/spuds/public_html/templates/default/base_home.php on line 20

Deprecated: Function ereg() is deprecated in /home/harlowad/public_html/spuds/public_html/includes/functions.php on line 47
1164

Would be most grateful :)
btw spuds is a subdomain

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Deprecated: Function ereg_replace()
« Reply #1 on: February 01, 2012, 08:15:20 PM »
Can i get a link to the website?

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #2 on: February 01, 2012, 09:13:55 PM »

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Deprecated: Function ereg_replace()
« Reply #3 on: February 01, 2012, 09:18:50 PM »
Are you sure you have the correct directory path?

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #4 on: February 01, 2012, 09:26:08 PM »
yea, just checked it and its correct

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Deprecated: Function ereg_replace()
« Reply #5 on: February 01, 2012, 09:37:37 PM »
Im trying to re-create this on my site and cant get it to happen. I really am not sure, if you want you can either wait till someone else gets on and can try and help or ou can PM me some login details to your server and ill have a look and see if i can get it working.

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #6 on: February 01, 2012, 10:03:36 PM »
thanks i'd appreciate that

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Deprecated: Function ereg_replace()
« Reply #7 on: February 01, 2012, 10:09:33 PM »
Ok... its not allowing me to change the directory path in the admin panel for some reason. But im wondering why there is two public_htmls in it

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #8 on: February 01, 2012, 10:32:33 PM »
thanks for looking and i think i may have found the answer at this site http://php.net/manual/en/migration53.deprecated.php
it says that in php5.3 they changed the function ereg_replace() (use preg_replace() instead).
Don't know if thats anything to do with it.

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #9 on: February 01, 2012, 10:42:50 PM »
ok so i changed this line
$categorynameu = ereg_replace('[^A-Za-z0-9]', '-', $categorynamev );
to
$categorynameu = preg_replace('[^A-Za-z0-9]', '-', $categorynamev );
and it appears to have worked.

smokey1908

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Deprecated: Function ereg_replace()
« Reply #10 on: February 02, 2012, 02:34:11 AM »
I still have three more errors i can't figure out at the moment.

1. Warning: Invalid argument supplied for foreach() in /home/harlowad/public_html/spuds/public_html/templates/default/base_home.php on line 44

2. Warning: include() [function.include]: Failed opening '/home/harlowad/spuds/public_html/includes/counter.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/harlowad/public_html/spuds/public_html/templates/default/template.php on line 225

3. Deprecated: Function ereg() is deprecated in /home/harlowad/public_html/spuds/public_html/includes/functions.php on line 47
1085

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Deprecated: Function ereg_replace()
« Reply #11 on: February 02, 2012, 06:36:34 AM »
You still have a ereg error in the stats if you did not notice. Also the other errors you are getting are in the script itself. I just posted a mod to fix this issue here. The reason its doing that is because there are no games added to the category yet and there is no check for that so it trys to display it as if there are games in it.

lopa

  • Newbie
  • *
  • Posts: 20
  • Force: +1/-0
Re: Deprecated: Function ereg_replace()
« Reply #12 on: February 02, 2012, 06:49:35 AM »
Im trying to re-create this on my site and cant get it to happen.

It really depends on the version of php that the server is using or to what extent the ISP makes the php "engine' backward compatible.

There are also many examples of what to do in this case on the web.

For every instance of ereg_replace - Find and replace with preg_replace

As for the "foreach" errors - Either something that is "expected" is missing, or there isn't an argument to tell "foreach" to ignore if it is missing.

Can I suggest that people download the latest version of XAMPP from "Apache Friends" and install it on their "box" - Because if you want to know where errors are or being generated - it will just about tell you everything that's not working, undefined variables, bad script or what has been deprecated.

And turning off "error reporting" will not fix the problems because the latest "php engine" is really getting tougher on what it will accept as passable script. ;)
« Last Edit: February 02, 2012, 07:09:29 AM by lopa »