-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
[ci skip] Clarify intention in phpdbg, removing one TODO comment #16014
Conversation
The point of WATCH_ON_BUCKET is to watch for all 3 fields of the bucket, so the fallthrough is intended.
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.
As the person that added the TODO when I introduced ZEND_FALLTHROUGH
to enable the compiler warning, I appreciate knowing why the fall through is needed. :)
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.
That's right :-)
@@ -138,10 +138,10 @@ const phpdbg_command_t phpdbg_watch_commands[] = { | |||
bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr) { | |||
switch (type) { | |||
case WATCH_ON_BUCKET: | |||
if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* key/val comparison */) != 0) { | |||
if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* hash+key comparison */) != 0) { | |||
return 2; |
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.
Unrelated thing I just noticed, but the function says it returns bool
but here it returns 2
.
I am going to blame myself for not catching this when I probably changed the return type, but is the value of 2
important here?
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.
See https://heap.space/search?project=PHP-7.0&project=PHP-7.1&full=&defs=&refs=phpdbg_check_watch_diff&path=&hist=&type= (seems to have been irrelevant from the beginning).
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.
Yeah indeed it seems irrelevant, maybe it was intended at one point to be used to signal the bucket key has changed, but who knows.
The point of WATCH_ON_BUCKET is to watch for all 3 fields of the bucket, so the fallthrough is intended.