-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/standard/head.c: Small refactoring of headers_sent()
#16109
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
base: master
Are you sure you want to change the base?
Conversation
6096c8b to
d344a08
Compare
| ZEND_TRY_ASSIGN_REF_LONG(by_ref_line, line); | ||
| } | ||
|
|
||
| RETURN_BOOL(SG(headers_sent)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick question: is there a reason why headers_sent global is not just a bool ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it hasn't been refactored since the move to C99, but it should yes.
| $file = null; | ||
| $line = null; | ||
|
|
||
| $v1 = headers_sent(line: $line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if using named params here (and later) was intentional?
| @@ -0,0 +1,110 @@ | |||
| --TEST-- | |||
| headers_sent() by-ref argument with named arguments | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file is a bit hard to read, maybe you should split the invocations with --- subtestname --- so that different subtests are easier to match between output and code.
| file = php_output_get_start_filename(); | ||
| } | ||
|
|
||
| switch(ZEND_NUM_ARGS()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code was written this way because this avoids a check: if we have a second param then we know the first one was also passed. The new code doesn't avoid such a check. It probably doesn't really matter however as the new code produces less machine code.
No description provided.