How to solve the use of deprecated function ereg() of PHP 5.3.0 in Drupal 6.13

后端 未结 8 504
自闭症患者
自闭症患者 2020-12-06 17:51

Anyone knows how to solve the error below?

Deprecated: Function ereg() is deprecated in C:\\wamp\\www\\includes\\file.inc on line 895

相关标签:
8条回答
  • 2020-12-06 17:57

    Just add @ in front of the function. e.g.

    @ereg()

    more issue relating upgraded your web servers which running PHP 5.3.0, pls refer

    http://www.rain-forest-forum.com/dotproject-net-installation-issues-t263.html

    0 讨论(0)
  • 2020-12-06 18:05

    This is not a Drupal issue.In the Drupal site it is noted that it does not yet support PHP 5.3 and there have been new error flags added to PHP.

    Solution1 : You can degarde the PHP version.You can revert back to PHP 5.2.x. As I am unsure of other conflicts with Drupal and PHP 5.3.

    Solution2 : However, if you prefer to keep PHP 5.3, you can always suppress the deprecated function errors. In Drupal’s includes/common.inc, Find the line :

    if ($errno & (E_ALL ^ E_NOTICE)) { And replace it with:

    if ($errno & (E_ALL & ~E_NOTICE & ~E_DEPRECATED)) {

    This will now always suppress the Deprecated error messages.

    0 讨论(0)
  • 2020-12-06 18:07

    One solution is to upgrade the offending sourcecode :-) It's explained here: http://drupal.org/node/514334#comment-2852940

    0 讨论(0)
  • 2020-12-06 18:09

    Drop your error reporting level below E_DEPRECATED.

    PHP 5.3 introduced two new error reporting levels, E_DEPRECATED and E_USER_DEPRECATED and - for the first time in PHP's history - they've started to walk away from older parts of their API. The ereg_* function will still work, but this warning is intended to let you know that "hey, these function will be going away soon, probably in the next major revision).

    0 讨论(0)
  • 2020-12-06 18:09

    Use

    preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
    

    Instead of

    ereg('\.([^\.]*$)', $this->file_src_name, $extension);
    
    0 讨论(0)
  • 2020-12-06 18:10

    Because I don't have time to update legacy code, I addeded following line to php code to suppress warnings.

    error_reporting(E_ALL ^ E_DEPRECATED);
    

    this line suppress only deprecated warnings. other errors are shown as usual.

    0 讨论(0)
提交回复
热议问题