disqus-wordpress-plugin icon indicating copy to clipboard operation
disqus-wordpress-plugin copied to clipboard

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

Open SeBsZ opened this issue 6 years ago • 12 comments

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.

SeBsZ avatar Aug 07 '18 10:08 SeBsZ

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 [email protected] 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 .

jaryszek avatar Aug 07 '18 10:08 jaryszek

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

@jaryszek Apologies for the delay. Working on this now

gddh avatar Aug 13 '18 22:08 gddh

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 [email protected] 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 .

jaryszek avatar Aug 14 '18 05:08 jaryszek

@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!

gddh avatar Aug 14 '18 18:08 gddh

@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 [email protected] 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 .

jaryszek avatar Aug 15 '18 11:08 jaryszek

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.

dlin168 avatar Aug 17 '18 05:08 dlin168

@ dlin168

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

Best, Jacek

pt., 17 sie 2018 o 07:00 dlin168 [email protected] 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 .

jaryszek avatar Aug 17 '18 05:08 jaryszek

Hi guys,

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

Cheers, E

nasyrov avatar Jan 19 '19 00:01 nasyrov

No support

W dniu sob., 19.01.2019 o 01:15 Evgenii Nasyrov [email protected] 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 .

jaryszek avatar Jan 19 '19 06:01 jaryszek

@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 avatar Apr 25 '19 18:04 archon810

@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?

archon810 avatar Apr 15 '21 18:04 archon810

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

dmatt avatar May 21 '21 23:05 dmatt