• Resolved Malae

    (@malae)


    There is a warning of deprecated code:

    FILE: /broken-link-checker/modules/extras/plaintext-url-parser-base.php
    WARNING AFFECTING LINE 82
    WARNING | The constant “FILTER_FLAG_HOST_REQUIRED” is deprecated since PHP 7.3

    Note: Version 1.11.8 has deprecated code since PHP 7.2.
    I am still using version 1.11.5 with patches posted earlier and am testing a patch for the above and will post it, if good after testing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Shaun Roselt

    (@shaunroseltgmailcom)

    FILE: /home/programming/public_html/wp-content/plugins/broken-link-checker/core/core.php
    ———————————————————————————————————–
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ———————————————————————————————————–
    957 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead
    ———————————————————————————————————–

    FILE: /home/programming/public_html/wp-content/plugins/broken-link-checker/modules/extras/plaintext-url-parser-base.php
    ———————————————————————————————————————–
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ———————————————————————————————————————–
    82 | WARNING | The constant “FILTER_FLAG_HOST_REQUIRED” is deprecated since PHP 7.3
    ———————————————————————————————————————–

    FILE: /home/programming/public_html/wp-content/plugins/broken-link-checker/modules/checkers/http.php
    ———————————————————————————————————–
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ———————————————————————————————————–
    147 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead
    ———————————————————————————————————–

    FILE: /home/programming/public_html/wp-content/plugins/broken-link-checker/includes/utility-class.php
    —————————————————————————————————–
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    —————————————————————————————————–
    42 | WARNING | INI directive ‘safe_mode’ is deprecated since PHP 5.3 and removed since PHP 5.4
    —————————————————————————————————–

    Thread Starter Malae

    (@malae)

    @shaunroseltgmailcom
    Hi Shaun,

    First of all
    42 | WARNING | INI directive ‘safe_mode’ is deprecated since PHP 5.3 and removed since PHP 5.4
    is a false positive, you may ignore. For the others see below.

    This plugin has been very useful for me and have found no other plugin that will do the same job. I have been fixing the deprecated code for the past couple of years in order to use the latest PHP version on the server, without being flooded with notices, warnings and errors. I use version 1.11.5 because that is the version that I have been fixing. I know that version 1.11.8 will throw errors that I had already corrected in version 1.11.5 and don’t have time to find out what was changed by the plugin support since that version.

    FILE: /broken-link-checker/modules/extras/plaintext-url-parser-base.php
    Comment out Line 82 and add new line. If you have problems reverse the process.

    //  if ( !filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) ){  DEPRECATED SINCE php 7.3 Delete ", FILTER_FLAG_HOST_REQUIRED" from line 82
    if ( !filter_var($url, FILTER_VALIDATE_URL) ){

    The following is a copy of my posting 4 months and 2 weeks ago:

    It would appear that someone had access to the repository that does not understand the issues. I had posted about the PHP 7.2 warnings almost a year ago and fixed them myself when there was no response from support. The plugin has since been working well on several sites. I cannot be responsible for any problems, but you may wish to try the changes I have been using.

    FILE: /wp-content/plugins/broken-link-checker/core/core.php
    FOUND 1 WARNING AFFECTING LINE 957 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead

    comment out line 957 with // as below and add the new code. If you have problems reverse the process.

    //	uasort($modules['container'], create_function('$a, $b', 'return strcasecmp($a["Name"], $b["Name"]);'));  // Change to anonymous function in line 958 to avoid deprecated 'create_function' in PHP 7.2
    			uasort($modules['container'], function($a, $b) { return strcasecmp($a["Name"], $b["Name"]); });

    FILE: /wp-content/plugins/broken-link-checker/modules/checkers/http.php
    FOUND 1 WARNING AFFECTING LINE 147 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead

    comment out line 147 with // as below and add the new code. If you have problems reverse the process.

    // create_function('$str','return rawurlencode($str[0]);'), Change to anonymous function in line 148 to avoid deprecated 'create_function' in PHP 7.2
    		 function ($str) { return rawurlencode($str[0]);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP 7.3 deprecated code warning’ is closed to new replies.