• Resolved Malae

    (@malae)


    Hi,

    I posted a message about two PHP warnings 11 months ago: as follows:

    FILE: /home/u440861037/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/u440861037/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
    -----------------------------------------------------------------------------------------------------------

    After waiting a month or so, and seeing other postings about the same issue, but no replies about fixing the issue, I corrected the code myself.

    4 days ago I saw the new version 1.11.8 and assumed that the corrections had been made, so I updated 8 sites only to find that the warnings had reappeared.

    Checking the code in the new 1.11.8 version, the above deprecated code had not been changed, so I was forced to reinstall the old version that I had corrected. I can only assume that corrections were made and the wrong old version was uploaded as version 1.11.8. If not, what was changed? Incidentally both old and new versions show version 1.11.5 in the broken-link-checker.php and readme.txt files.

    I think an explanation is in order.

Viewing 6 replies - 1 through 6 (of 6 total)
  • terry777

    (@terry777)

    I got:
    [25-Mar-2019 11:37:08 UTC] PHP Deprecated: Function create_function() is deprecated in …/wp-content/plugins/broken-link-checker/modules/checkers/http.php on line 147

    Stian Lund

    (@pathduck)

    I think the developers of this plugin have made it pretty clear they are not interested in helping people on this forum… ??

    The code needs needs to be rewritten to avoid these warning about deprecated code, but it’s AFAIK only minor modifications of two files needed. My skill with PHP is not good enough to figure out how to change it, I don’t even know what an ‘anonymous function’ is.
    https://www.php.net/manual/en/function.create-function.php

    • This reply was modified 6 years ago by Stian Lund.
    Thread Starter Malae

    (@malae)

    @pathduck Hello Stian,

    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]); },
    • This reply was modified 5 years, 12 months ago by Malae.

    @malae Thank you for that – my site is actually still running PHP5 so I don’t see those warnings, and unable to test. Even if I’d like to update PHP it’s a shared system so I have to wait for the powers that be…

    Those changes look pretty simple though. Did you create a pull request on their Github repo? I couldn’t do it myself, because I can’t honestly submit a PR without the ability to test it ??

    Thread Starter Malae

    (@malae)

    @pathduck No problem. No I didn’t post anything to Github because I notices in other postings here in support that someone else had already. The issue is that whoever is handling the plugin at present is not paying any attention to anything in support or Github.

    You should try to find hosting with PHP 7.1 or better. There is even some free hosting that has it.

    • This reply was modified 5 years, 12 months ago by Malae.

    In the community fork we are following these issues. I think this was already resolved due to community commits that did not get included in the main plugin

    https://github.com/HongPong/broken-link-checker/issues/23

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Version 1.11.8 PHP Warnings again!!’ is closed to new replies.