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

Replace @ in front of header() with a test #6087

Closed
wants to merge 1 commit into from

Conversation

kylekatarnls
Copy link
Contributor

The @ is bad practice I think, I do not know if Piwik care about it. But if the goal of this one was to hide the "headers already sent" error, I suggest to test it explicitly.

@mattab
Copy link
Member

mattab commented Aug 29, 2014

Not sure if it makes sense to change only one header call. If you search in piwik for @header you will dozens of such calls...

@mattab mattab closed this Aug 29, 2014
@mattab mattab added the wontfix label Aug 29, 2014
@kylekatarnls
Copy link
Contributor Author

if there are so many, it must be factorized. For example, in the exception handle method to put it on all exceptions.

@mattab
Copy link
Member

mattab commented Aug 29, 2014

there's already a function that we should reuse https://github.com/piwik/piwik/blob/master/core/Common.php#L1041

@diosmosis
Copy link
Member

This is legacy code, it will be removed eventually when output formatting systems are further refactored.

@kylekatarnls
Copy link
Contributor Author

Ok, so if you think it would be better to remove @ in front of each header(), I can look for all header() calls that do not uses Common, put the test in Common and redo a pull-request.

@mattab
Copy link
Member

mattab commented Aug 29, 2014

@kylekatarnls sounds like a good plan, @diosmosis @tsteur any thoughts?

@tsteur
Copy link
Member

tsteur commented Aug 29, 2014

Best would be to solve the actual problem meaning: Why are there already headers sent before at all? And when can headers be already sent and when not? Probably needs a deeper look. Sounds like a component from a deeper layer maybe already sends a header that is not supposed to send one. But didn't have a detailed look.

In general +1 for removing @ . It is bad practice to use it.

@kylekatarnls
Copy link
Contributor Author

Here is the list of all @Header() in the code and one @$_SERVER['...']
https://github.com/kylekatarnls/piwik/compare/cleanup-arobases
I can send it if you want to use it while inspect the code deeper.

@mattab
Copy link
Member

mattab commented Sep 9, 2014

sendHeader does not put the @ in front of header call - your change to replace all header() calls by sendHeader() looks good!

Maybe you can issue new pull request for that change @kylekatarnls ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants