SMF Support > SMF 1.1.x Support
Function ereg_replace() is deprecated on Subs.php - help!
smashmash:
Hi All - forum has been running smoothly for a long time now but suddenly came up against this yesterday - I'm guessing it's to do with a php update change on functionality or something?
The line being collared as the trouble maker is this:
if (setlocale(LC_TIME, @$txt['lang_locale']))
{
$str = ereg_replace('%a', ucwords(strftime('%a', $time)), $str);
But this is the first of many lines following that use the ereg_replace function so I guess there's quite a few changes to so here.
Can anyone please help me out with code to work around?
Much appreciated! :)
*EDIT* Sorry this ye olde 1.08 forum @ bullterrierforum.co.uk/forum
Arantor:
Yes, that's due to a PHP update, as of 5.3 the ereg functions have been deprecated (and will be removed in future)
Simple answer is to upgrade, I don't believe even 1.0.22 has that patched though, which means an upgrade to at least 1.1.x (1.1.16 at present time) or even 2.0.x (2.0.2 at present time)
MrPhil:
You're running an old SMF forum on PHP 5.3, and you'll have it falling over with "deprecated function" warnings all over the place. It's possible to fix them (see http://us.php.net/manual/en/migration53.deprecated.php) but you'd be a lot better off going to 1.1.16 or (even better) 2.0.2.
As an example, the statement
--- Code: ---$str = ereg_replace('%a', ucwords(strftime('%a', $time)), $str);
--- End code ---
would become
--- Code: ---$str = preg_replace('/%a/', ucwords(strftime('%a', $time)), $str);
--- End code ---
Please do not reply with "the next one is ____, please fix it". There will be dozens, if not hundreds, of these errors to fix.
Arantor:
I'd argue an upgrade is absolutely required, there's already 14 missing patches on that forum (as well as 12 missing on the other forum in the OP's signature)
smashmash:
Many thanks for your replies - OK, I understand I need to upgrade. I had been avoiding it because in the paste upgrades have gone badly for me - losing instant messages and attachments to posts. I guess to get the old girl anywhere near modern will take several upgrade steps - that's my evening mapped out then!
Navigation
[0] Message Index
[#] Next page
Go to full version