Skip to content

Commit 7a085fb

Browse files
committed
TODO Notes
1 parent b575d03 commit 7a085fb

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
@@ -1410,6 +1410,7 @@ ZEND_FUNCTION(gmp_root)
14101410
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
14111411

14121412
if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) {
1413+
// Todo promote to ValueError?
14131414
php_error_docref(NULL, E_WARNING, "Can't take even root of negative number");
14141415
FREE_GMP_TEMP(temp_a);
14151416
RETURN_FALSE;
@@ -1442,6 +1443,7 @@ ZEND_FUNCTION(gmp_rootrem)
14421443
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
14431444

14441445
if (nth % 2 == 0 && mpz_sgn(gmpnum_a) < 0) {
1446+
// Todo promote to ValueError?
14451447
php_error_docref(NULL, E_WARNING, "Can't take even root of negative number");
14461448
FREE_GMP_TEMP(temp_a);
14471449
RETURN_FALSE;
@@ -1578,6 +1580,7 @@ ZEND_FUNCTION(gmp_invert)
15781580
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
15791581
RETURN_THROWS();
15801582
}
1583+
// TODO Check b_arg is not 0 as behaviour is undefined for op2 = 0 for mpz_invert
15811584

15821585
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1);
15831586
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a, 2);
@@ -1587,6 +1590,7 @@ ZEND_FUNCTION(gmp_invert)
15871590
FREE_GMP_TEMP(temp_a);
15881591
FREE_GMP_TEMP(temp_b);
15891592
if (!res) {
1593+
// Should return 0 instead of false? A legit 0 value is impossible.
15901594
zval_ptr_dtor(return_value);
15911595
RETURN_FALSE;
15921596
}

0 commit comments

Comments
 (0)