Jump to content

Need help with deprecated eregi


Recommended Posts

I get this error whenever I get on my front page: Deprecated: Function eregi() is deprecated in /home/mizunosa/public_html/tools/smarty/compile/1e51a08077c4e8820cf2a57b536ac567949d3a81.file.header.tpl.php on line 83

I tried to replace the eregi to preg_match like this but still having the same error.

if (eregi("MSIE 7",$_SERVER['HTTP_USER_AGENT'])){?><?php }else{ ?>
to
if (preg_match("/MSIE 7/i",$_SERVER['HTTP_USER_AGENT']))
{
// {?><?php else ?>
}

also got this error: SELECT *

FROM `ps_editorial` a LEFT JOIN `ps_editorial_lang` b ON (a.`id_editorial` = b.`id_editorial` AND `id_lang` = 1) WHERE a.`id_editorial` = 1 LIMIT 1</pre>

It says I must have the editorial_lang but I can't find it anywhere.

Any idea how to fix this? :(

Edited by Nori (see edit history)
Link to comment
Share on other sites

What version of Prestashop are you using? With Prestashop 1.4.8.2 the number of spots with a legacy ereg() call are limited to a handful of modules plus the ajaxfilemanager, none of which I think would be triggered on the homepage. So it likely means you are running an older version or you have a module enabled that relies on ereg. Changing the compiled Smarty template is not a solution - you need to find the where in the source that is being done.

 

Temporarily you can disable the warnings via .htaccess file but it is better to correct the real issue since it will eventually cause a fatal error down the road with future PHP versions.

 

If you are under Linux you can do this via the shell to try to track it down (from the Prestashop directory):

 

find . -type f -name \*.php -exec grep -H ereg {} \;

 

The output of that will include some false positives but should give you enough detail to sort out which file(s) you need to change.

 

As to your second error, that sounds like a module problem - try disabling the editorial module and see if that goes away. If so, then you may need to uninstall and re-install that module to build up the correct table structure (just be sure to do a backup before hand).

 

Cheers

Link to comment
Share on other sites

×
×
  • Create New...