-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Gmp warning to error #5882
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
Gmp warning to error #5882
Conversation
4c07065
to
a0d7f93
Compare
a0d7f93
to
c3789cf
Compare
@kocsismate can you have a look at some of the error messages in here? |
c3789cf
to
e1c3356
Compare
Are there other issues/objections to this? Or can I merge this before FF gets tagged on Tuesday? |
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.
Love the signature changes :)
e1c3356
to
85a4dbe
Compare
ext/gmp/gmp.c
Outdated
@@ -381,6 +384,10 @@ static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval | |||
DO_BINARY_UI_OP_EX(mpz_tdiv_q, gmp_mpz_tdiv_q_ui, 1); | |||
case ZEND_MOD: | |||
DO_BINARY_UI_OP_EX(mpz_mod, gmp_mpz_mod_ui, 1); | |||
if (UNEXPECTED(EG(exception))) { | |||
return FAILURE; |
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.
Is it actually necessary to return failure on exception here? I think if we throw, this should still be success, otherwise we're going to try calling do_operation on the second operand again.
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 forgot to drop this again but the DO_BINARY_UI_OP_EX
macro does exactly that:
#define DO_BINARY_UI_OP_EX(op, uop, check_b_zero) \
gmp_zval_binary_ui_op( \
result, op1, op2, op, uop, check_b_zero \
); \
if (UNEXPECTED(EG(exception))) { return FAILURE; } \
return SUCCESS;
ext/gmp/gmp.c
Outdated
RETURN_FALSE; | ||
} | ||
FETCH_GMP_ZVAL(gmpnum, a_arg, temp_a, 1); | ||
FREE_GMP_TEMP(temp_a); |
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.
Shouldn't this function just accept int
instead? Makes little sense to convert to GMP first and then convert back to integer.
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.
Well the function should be able to accept a GMP object, but it's true that this code makes little sense atm.
85a4dbe
to
b0c77ff
Compare
This gets rids of most false returns.