Fix headers already sent error in version 3.7.4 #376
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The debug log shared by merchant here shows a php warning about "Headers already sent"
PHP Warning: Cannot modify header information - headers already sent by (output started at /homepages/44/MDSP/htdocs/wordpress/wp-content/plugins/blockonomics-bitcoin-payments/php/form_fields.php:1) in /homepages/44/MDSP/htdocs/wordpress/wp-includes/http.php on line 505
This is caused by empty line before php tag declaration in
php/form_fields.php
file. This is causing php functions that need to send HTTP headers (like setcookie(), session_start(), or header()) to fail because content has already been sent to the browser.This file also had missing ABSPATH check. Without this check, if someone knows the file's URL, they could potentially access and execute the file directly, making this a potential security risk. I've added this statement in this PR to fix this.