osCommerce / oscommerce2

osCommerce Online Merchant v2.x
http://www.oscommerce.com
MIT License
281 stars 222 forks source link

2.4 bug on HTTP #625

Open oitsuki opened 6 years ago

oitsuki commented 6 years ago

On php 7.1 and 7.2 we can have this problem (generated on my version) PHP Warning: Cannot modify header information - headers already sent by HTTP.php on line 334 header('Location: ' . $url, true, $http_response_code);

pale2hall commented 6 years ago

If you view the source, is there any output before that?

Usually this is an error because there was an echo or an error message sending some output before the header("Location: $url"); call.

oitsuki commented 6 years ago

There function. I don't arrived to identifywhen this pb happen. It's obscur.

    public static function redirect($url, $http_response_code = null)
    {
        if ((strstr($url, "\n") === false) && (strstr($url, "\r") === false)) {
            if ( strpos($url, '&') !== false ) {
                $url = str_replace('&', '&', $url);
            }

            header('Location: ' . $url, true, $http_response_code);
        }

        exit;
    }