• Resolved therealgilles

    (@chamois_blanc)


    I am seeing the following PHP notice when running wp-cron:

    Notice: Undefined index: HTTP_HOST in …/wp-content/plugins/simple-301-redirects/wp-simple-301-redirects.php on line 170

    Please fix.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @chamois_blanc,

    Hope you are doing well.

    I am so sorry for this inconvenience. Please try once with this Dev version plugin: https://d.pr/f/IGEDIj

    Hope your issue will be fixed. Let us know how it goes.

    Thanks!

    Plugin Support AR Rasel

    (@arrasel403)

    Hi @chamois_blanc,

    We haven’t heard back from you in a long time. So, I am assuming your issue has been resolved. I am closing this topic.

    Have a nice day!

    Can confirm the issue established and retained in 2.0.6.

    It looks like the function get_address() gets called in contexts there is no HTTP available, which confirms this original report.

    @arrasel403: Please reopen.

    To add a bit more information, the issue manifested when running within cron and the PHP 8.0 language level. With the PHP 7.4 language level I didn’t see this notice. As PHP 7.4 will be out of main project support this year, and the plugin should be forward compatible with PHP 8.0 / 8.1 language levels, I think it is worth to address this notice.

    A first fix I’m currently running is to have the function return void (as in the phpdoc which also looks like an error) in case HTTP_HOST is not within $_SERVER.

    I must admit I have no clue why the function is called in the cron context anyway, but this is perhaps something that rings a bell on your end.

    This type of fix prevents the notice naturally and it didn’t produce any other notices as a side-effect so far.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP notice when running wp-cron’ is closed to new replies.