Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting notice "Undefined index: host" when running PHP command line scripts #57

Open
SeBsZ opened this issue Aug 7, 2018 · 12 comments

Comments

@SeBsZ
Copy link

SeBsZ commented Aug 7, 2018

class-disqus-admin.php has a filter for the get_rest_url function

public function dsq_filter_rest_url( $rest_url )

The issue is line 167 in this function:
$current_host = $_SERVER['HTTP_HOST'];

When running PHP scripts on the command line (we have workers running through Supervisord) HTTP_HOST is undefined as there is no web server.

This generates a PHP notice every time:

PHP Notice: Undefined index: host in /srv/www/htdocs/my_website/public/wp-content/plugins/disqus-comment-system/admin/class-disqus-admin.php on line 162

Can a check be added if this variable exists before it is used, or can it be suppressed?

I tried to prevent Disqus from loading using the dsq_can_load filter but that has no effect. Alternatively I could try to prevent the whole plugin from running.

@jaryszek
Copy link

jaryszek commented Aug 7, 2018 via email

@gddh
Copy link
Contributor

gddh commented Aug 13, 2018

@SeBsZ working to get this done. Thank you for your patience!

@jaryszek Apologies for the delay. Working on this now

@jaryszek
Copy link

jaryszek commented Aug 14, 2018 via email

@gddh
Copy link
Contributor

gddh commented Aug 14, 2018

@jaryszek I'll do my best to get it done and to get some other issues fixed given my constraints. I cannot guarantee I can get to them, but I will try my best. Is that ok Jacek?

Again thank you for your patience and sticking with this Jacek!

@jaryszek
Copy link

jaryszek commented Aug 15, 2018 via email

@dlin168
Copy link

dlin168 commented Aug 17, 2018

You are definitely very reasonable and perceptive Jacek! I hope you will also understand that there are other parts of Disqus that we are working on as well to better serve you and other members of the Disqus community. At the same time we want to address these problems, so that is why we want to get to them, but cannot guarantee it.

Do I make sense Jacek? Please let me know if I am being unclear!

Again, thank you for your patience with us Jacek.

@jaryszek
Copy link

jaryszek commented Aug 17, 2018 via email

@nasyrov
Copy link

nasyrov commented Jan 19, 2019

Hi guys,

Why it hasn't been released yet? It's annoying to have a warning in the console every time ...

Cheers,
E

@jaryszek
Copy link

jaryszek commented Jan 19, 2019 via email

@archon810
Copy link

@wedamija @gddh The 2nd part of the fix is still unreleased and needed. Please consider fixing this fully per #60 (comment).

@archon810
Copy link

@dmatt @Hovspian @tterb We still get lots of notices from line 162. Can you please finally push through the fix to this 3-year-old bug?

@dmatt
Copy link
Contributor

dmatt commented May 21, 2021

Most recent update here #60 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants