I have been working with my Drupal site for slightly over a month now, and I have seen various warnings appear on different screens. These warnings did not affect the site so I did not dedicate much time to resolving these issues. Today I finally felt the urge to resolve these issues. The number of messages that Drupal must process and display on the page greatly increased the time required to display the page. I can reproduce the issue by going to logging in as administrator and going to Administer, then Site Building, and then Modules.
I decided to focus on the warning Function ereg() is deprecated in /var/www/site/includes/file.inc on line 895 because this particular warning appeared more times than any other. A page dedicated to this warning can be found on Drupal's site. The comments on this page suggest many possible resolutions. One solution suggested modifying line 895 of file/var/www/site/includes/file.inc (the offending line mentioned by the error message).
The solution suggested adding an '@' before the function call ereg() (the function call mentioned by the error message. I had never heard of this operator before, so I did a little research. I finally found the this page on php.net which explains that when an '@' symbol is "prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored." I made the required modification and the warning disappeared.
I wouldn't really call this a fix because this does not solve the underlying issue; it is a band-aid. So what is the underlying issue? The function ereg() is deprecated in php 5.3 according to this page on php.net, and the function preg_match(), which is faster and uses a Perl-compatible regular expression syntax, should be used instead.
According to a comment by VM on Drupal's site, Drupal 6 does not support PHP 5.3 until Drupal version 6.14. The ideal solution to this problem (and probably every other warning I see) is to upgrade from Drupal version 6.9 to 6.14 (or higher). I read an article on Drupal's site on upgrading which involved backing up my site and it sounded like quite a bit of work. I felt this would be a good article for another post on another day. So I decided to go the route of adding '@' before the function call to suppress the error messages.
Thanks for reading.