Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace getThis() by EX(This), when additional check is not necessary.
- Loading branch information
Showing
44 changed files
with
569 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
c6ad0b9
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'd really prefer to keep this at getThis(), which has been the standard way of accessing $this since forever and does not rely on implementation details -- the next time we want to change something here, we're going to have to update large amounts of extension code where this access is now hardcoded.
We can drop the null check from getThis() and add a separate macro (e.g. tryGetThis()) for the much rarer case where $this might not be set.
c6ad0b9
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.
@nikic I agree, getThis() looked better than EX(This).
Now, I replaced almost all getThis() with useless check by EX(This), but we have a lot of places where we still need getThis() with check. Changing the behavior of getThis() + additional macro is a bad idea, I think.
I suppose, we need a good macro name for getThis() without check, or getThisEx(do_check), or add argument for getThis() macro (BC break), or something else. Your ideas are welcome...
c6ad0b9
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.
Okay, I can see how changing the behavior of
getThis()
is probably not a good idea. We might use this opportunity to move to new macros with more standard naming, e.g.ZEND_THIS()
for just getting&EX(This)
and something likeZEND_THIS_OR_NULL()
,ZEND_TRY_THIS()
,ZEND_MAYBE_THIS()
or similar for the case where it may not be set.c6ad0b9
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.
ZEND_THIS() without check, ZEND_GET_THIS() with check and keep getThis() for compatibility. OK?
c6ad0b9
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.
@nikic ^^