Skip to content

Commit 42afdad

Browse files
committed
TODO Notes
1 parent 585ac45 commit 42afdad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/gmp/gmp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,7 @@ ZEND_FUNCTION(gmp_root)
14141414
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
14151415

14161416
if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) {
1417+
// Todo promote to ValueError?
14171418
php_error_docref(NULL, E_WARNING, "Can't take even root of negative number");
14181419
FREE_GMP_TEMP(temp_a);
14191420
RETURN_FALSE;
@@ -1446,6 +1447,7 @@ ZEND_FUNCTION(gmp_rootrem)
14461447
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
14471448

14481449
if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) {
1450+
// Todo promote to ValueError?
14491451
php_error_docref(NULL, E_WARNING, "Can't take even root of negative number");
14501452
FREE_GMP_TEMP(temp_a);
14511453
RETURN_FALSE;
@@ -1582,6 +1584,7 @@ ZEND_FUNCTION(gmp_invert)
15821584
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
15831585
RETURN_THROWS();
15841586
}
1587+
// TODO Check b_arg is not 0 as behaviour is undefined for op2 = 0 for mpz_invert
15851588

15861589
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
15871590
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a, 2);
@@ -1591,6 +1594,7 @@ ZEND_FUNCTION(gmp_invert)
15911594
FREE_GMP_TEMP(temp_a);
15921595
FREE_GMP_TEMP(temp_b);
15931596
if (!res) {
1597+
// Should return 0 instead of false? A legit 0 value is impossible.
15941598
zval_ptr_dtor(return_value);
15951599
RETURN_FALSE;
15961600
}

0 commit comments

Comments
 (0)