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

Premature ob_end_flush() before header modification...? #2298

Open
tamasoz opened this issue May 5, 2019 · 0 comments
Open

Premature ob_end_flush() before header modification...? #2298

tamasoz opened this issue May 5, 2019 · 0 comments

Comments

@tamasoz
Copy link

tamasoz commented May 5, 2019

Hi,

I am by no means any good at PHP but I encountered the following issue using osclass 3.8 and the latest PaymentPro plugin...

The problem was there (line 1472 in utils.php):

function osc_redirect_to($url, $code = null) { if(ob_get_length()>0) { ob_end_flush(); } if($code!=null) { header("Location: ".$url, true, $code); } else { header("Location: ".$url); } exit; }

Then I noticed that when I update the PaymentPro plugin the response stalls...the logfile showed the following error:

PHP Warning: Cannot modify header information - headers already sent...
...and then the reference to the utils.php file.

As far as I understand this function closes a stream or flushing the stream of some sort then tries to modify the header...which is not possible after calling the ob_end_flush()...according to the doco..

As a solution I swaped the two calls around and it worked...so far anyway...
`function osc_redirect_to($url, $code = null) {

if($code!=null) {
    header("Location: ".$url, true, $code);
} else {
    header("Location: ".$url);
}

if(ob_get_length()>0) {
    ob_end_flush();
}
exit;

}`

I am not sure if this is a real issue or just some localized mayhem here...but I thought I let you know....

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

1 participant