WordPress-Plugin icon indicating copy to clipboard operation
WordPress-Plugin copied to clipboard

PHP Warning "Cannot modify header information - headers already sent" on other plugins' settings pages

Open benvoynick opened this issue 4 years ago • 10 comments

In the class Purgely_Settings_Page, the function settings_errors() from WordPress Core is called in an admin_menu hook. There are a couple issues with this.

  • The plugin does not check that it is on a settings page, nor that it is specifically on a settings page managed by the plugin.
  • admin_menu is not the right place to call settings_errors(), as HTML output has not started in this hook. This in combination with the above can cause this PHP warning on other settings pages outside the Fastly plugin.

I'm not certain of the proper fix, as I don't know what customizations require calling settings_errors() directly. But as far as hooks go possibly admin_notices is the right place to call this, if that hook has its expected effect on Fastly forms rendering.

benvoynick avatar Jan 04 '21 23:01 benvoynick

Does anybody know how to fix this issue because we are also seeing the same problem on one of our Wordpress sites?

randallache avatar Mar 12 '21 20:03 randallache

We are investigating.

vvuksan avatar Mar 19 '21 22:03 vvuksan

We can't reproduce the problem. @benvoynick and @randallache - can you please let us know what version of wordpress are you using and what other plugins are installed on the system?

hrvojejurisic avatar Mar 22 '21 21:03 hrvojejurisic

@hrvojejurisic I am using WordPress version: 5.7 with the following plugins:

  • Advanced Custom Fields (Version 5.9.5)
  • Advanced Woo Search Version 2.23
  • Custom Post Type UI Version 1.8.2
  • Disable Comments Version 2.1.0
  • FacetWP Version 3.8.1
  • Fastly Version 1.2.17
  • Folders Version 2.6.8
  • Gravity Forms Version 2.4.23
  • GTranslate Version 2.8.61
  • Post SMTP Version 2.0.22
  • Smush Version 3.8.3
  • Really Simple SSL Version 4.0.13
  • WooCommerce Version 5.1.0
  • Wordfence Security Version 7.4.14
  • Yoast SEO Premium Version 15.1.2

randallache avatar Mar 24 '21 13:03 randallache

Tried with plugins installed... still no success with reproducing the error.

Can you please describe the steps needed to reproduce the issue?

hrvojejurisic avatar Mar 29 '21 13:03 hrvojejurisic

Hello guys,

We are still unable to reproduce the reported issue. As Hrvoje has said, we have tried with the same WP version && plugins but with no luck. Please, can you share more information with us on how to reproduce the issue. Maybe send us DB tables with WP config?

We have developed a patch that will probably solve the issue but we cannot be 100% sure because we weren't able to test it. Please install it on testing env. and let us know if the issue is gone. If not, we will need more info on how to reproduce the issue.

issue_86_fix.patch.zip

Thanks, Nenad

NenadAndrakovic avatar Apr 14 '21 13:04 NenadAndrakovic

I will work in this testing after lunch today once I am back at my computer and finished with this conference I am at today. I will update you once this has been completed .

Randall

On Wed, Apr 14, 2021 at 8:49 AM Nenad Andraković @.***> wrote:

Hello guys,

We are still unable to reproduce the reported issue. As Hrvoje has said, we have tried with the same WP version && plugins but with no luck. Please, can you share more information with us on how to reproduce the issue. Maybe send us DB tables with WP config?

We have developed a patch that will probably solve the issue but we cannot be 100% sure because we weren't able to test it. Please install it on testing env. and let us know if the issue is gone. If not, we will need more info on how to reproduce the issue.

issue_86_fix.patch.zip https://github.com/fastly/WordPress-Plugin/files/6311220/issue_86_fix.patch.zip

Thanks, Nenad

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fastly/WordPress-Plugin/issues/86#issuecomment-819532980, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK6B5OL2C3QHRUM3R2CL7ADTIWMOZANCNFSM4VTZCGPA .

--

  • Randall Aché CEO/ Partner Ruby Shore Software - formerly Lunabyte and Twin Engine Labs Phone: 318.625.0860 Direct: 318.317.2918 Cell: 318.347.8472 @.***

randallache avatar Apr 14 '21 14:04 randallache

I put this in a branch

https://github.com/fastly/Wordpress-plugin/tree/issue_86_fix

Compare is here

https://github.com/fastly/WordPress-Plugin/compare/issue_86_fix

vvuksan avatar Apr 14 '21 14:04 vvuksan

Support,

Can you please confirm how this patch should be installed? Are we simply uploading the new zip as a plugin because when we extract the zip file we noticed there is a plain text file called patch.

Randall

On Wed, Apr 14, 2021 at 8:49 AM Nenad Andraković @.***> wrote:

Hello guys,

We are still unable to reproduce the reported issue. As Hrvoje has said, we have tried with the same WP version && plugins but with no luck. Please, can you share more information with us on how to reproduce the issue. Maybe send us DB tables with WP config?

We have developed a patch that will probably solve the issue but we cannot be 100% sure because we weren't able to test it. Please install it on testing env. and let us know if the issue is gone. If not, we will need more info on how to reproduce the issue.

issue_86_fix.patch.zip https://github.com/fastly/WordPress-Plugin/files/6311220/issue_86_fix.patch.zip

Thanks, Nenad

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fastly/WordPress-Plugin/issues/86#issuecomment-819532980, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK6B5OL2C3QHRUM3R2CL7ADTIWMOZANCNFSM4VTZCGPA .

--

  • Randall Aché CEO/ Partner Ruby Shore Software - formerly Lunabyte and Twin Engine Labs Phone: 318.625.0860 Direct: 318.317.2918 Cell: 318.347.8472 @.***

randallache avatar May 26 '21 12:05 randallache

Hi @randallache,

If you have access to the wordpress server the best thing would be to apply the patch with the patch command. For example you would need to go into the wp-content/plugins/fastly directory (e.g./var/www/html/wp-content/plugins/fastly) then use following command to patch the code

patch -i issue_86_fix.patch -p1

If you are unsure how to do that you may be able to download ZIPped plugin with the change here

https://github.com/fastly/WordPress-Plugin/tree/issue_86_fix

However you may need to first deinstall the current plugin then install the ZIP by hand.

vvuksan avatar May 26 '21 15:05 vvuksan