Skip to content

Commit 16acea4

Browse files
committed
ext/gmp: Add weak mode support for parsing
1 parent a67d363 commit 16acea4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ext/gmp/gmp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ static bool gmp_zend_parse_arg_into_mpz_ex(
187187
mpz_set_si(*destination_mpz_ptr, Z_LVAL_P(arg));
188188
return true;
189189
}
190+
191+
if (!ZEND_ARG_USES_STRICT_TYPES()) {
192+
zend_long lval = 0;
193+
if (is_operator && Z_TYPE_P(arg) == IS_NULL) {
194+
return false;
195+
}
196+
if (!zend_parse_arg_long_weak(arg, &lval, arg_num)) {
197+
return false;
198+
}
199+
200+
mpz_set_si(*destination_mpz_ptr, lval);
201+
202+
return true;
203+
}
204+
190205
return false;
191206
}
192207

0 commit comments

Comments
 (0)