Deprecated: Function … is deprecated in PHP

Symptom:

Shows errors like below on your Joomla, Drupal or in any other php coded webpage.

  • Deprecated: Function ereg() is deprecated in …
  • Deprecated: Function split() is deprecated in …
  • Deprecated: Function set_magic_quotes_runtime() in …
  • …will add more…Please let me know if you find more.

Reason:

Those functions got replaced with alternate ones. (Sorry that I don’t know the reason behind that. May be the new ones might have some new features). Also I experienced this problem after upgrading PHP engine on my server.

Fix:

ereg() fix:

FTP the web server and open the file showing error, search for “ereg” and replace ereg(…) with mb_ereg(…). The syntax is same for both. (Try this and keep it if it works. It will work 90{88dc7f9385b2c8971f38421926506de3e3fc5e843c9520f0674d4b7de6ae62da} sure.)

split() fix:

FTP the web server and open the file showing error, search for “split” and replace split(…) with explode(…). (Same as above.)

set_magic_quotes_runtime() fix:

Replace the below line showing error

set_magic_quotes_runtime(0);

with below code

// Check if magic_quotes_runtime is active
if(get_magic_quotes_runtime())
{
// Deactivate
set_magic_quotes_runtime(false);
}

Note: More findings will be added to this post as and when I experience them. Please comment below if you had experienced and fixed any other deprecations.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.