disqus / disqus-wordpress-plugin

WordPress plugin for Disqus (Latest version)
https://disqus.com/
34 stars 25 forks source link

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

Open SeBsZ opened 6 years ago

SeBsZ commented 6 years ago

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 commented 6 years ago

Wow SeBsZ you provided them readu solution. I do not know why they still do not react...

Best, Luke

wt., 7 sie 2018 o 12:08 SeBsZ notifications@github.com napisał(a):

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/apkmirror_dev/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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/disqus/disqus-wordpress-plugin/issues/57, or mute the thread https://github.com/notifications/unsubscribe-auth/AavzWD_fHlEssEklr_2jlCmnn8ftAltnks5uOWcggaJpZM4Vx3hA .

gddh commented 6 years ago

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

@jaryszek Apologies for the delay. Working on this now

jaryszek commented 6 years ago

Hi,

@gddh. Thank you, Will you run the update for disqus in order to eliminate issue pernamently?

Best, Jacek

wt., 14 sie 2018 o 00:19 gddh notifications@github.com napisał(a):

@SeBsZ https://github.com/SeBsZ working to get this done. Thank you for your patience!

@jaryszek https://github.com/jaryszek Apologies for the delay. Working on this now

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/disqus/disqus-wordpress-plugin/issues/57#issuecomment-412684407, or mute the thread https://github.com/notifications/unsubscribe-auth/AavzWOPFmNR1EhTyTC1PLnhDudlBKUteks5uQftegaJpZM4Vx3hA .

gddh commented 6 years ago

@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 commented 6 years ago

@gddh.

Thank you. What do you mean "I cannot guarantee I can get to them"? It is your plugin, you are the authors and you have power (and only you) to fix your tool.

Best, Jacek

wt., 14 sie 2018 o 20:04 gddh notifications@github.com napisał(a):

@jaryszek https://github.com/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!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/disqus/disqus-wordpress-plugin/issues/57#issuecomment-412963402, or mute the thread https://github.com/notifications/unsubscribe-auth/AavzWJvQ0svFzULFCx-2EYAdnmYXg4iSks5uQxEogaJpZM4Vx3hA .

dlin168 commented 6 years ago

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 commented 6 years ago

@ dlin168

thank it is clear for me. So we are still waiting :)

Best, Jacek

pt., 17 sie 2018 o 07:00 dlin168 notifications@github.com napisał(a):

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 I want to address these problems, so that is why I 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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/disqus/disqus-wordpress-plugin/issues/57#issuecomment-413758055, or mute the thread https://github.com/notifications/unsubscribe-auth/AavzWA2z1HwUREoOid8UFbJmxW6HBfD3ks5uRk3qgaJpZM4Vx3hA .

nasyrov commented 5 years ago

Hi guys,

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

Cheers, E

jaryszek commented 5 years ago

No support

W dniu sob., 19.01.2019 o 01:15 Evgenii Nasyrov notifications@github.com napisał(a):

Hi guys,

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

Cheers, E

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/disqus/disqus-wordpress-plugin/issues/57#issuecomment-455727782, or mute the thread https://github.com/notifications/unsubscribe-auth/AavzWPoIF2AkztteWlpNJXSy1NTMrXqDks5vEmOvgaJpZM4Vx3hA .

archon810 commented 5 years ago

@wedamija @gddh The 2nd part of the fix is still unreleased and needed. Please consider fixing this fully per https://github.com/disqus/disqus-wordpress-plugin/pull/60#issuecomment-450633415.

archon810 commented 3 years ago

@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 commented 3 years ago

Most recent update here https://github.com/disqus/disqus-wordpress-plugin/pull/60#issuecomment-846306095