Skip to content

Commit b5d6d6a

Browse files
committed
ext/gmp: Add weak mode support for parsing
1 parent c0ac32a commit b5d6d6a

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
@@ -188,6 +188,21 @@ static bool gmp_zend_parse_arg_into_mpz_ex(
188188
mpz_set_si(*destination_mpz_ptr, Z_LVAL_P(arg));
189189
return true;
190190
}
191+
192+
if (!ZEND_ARG_USES_STRICT_TYPES()) {
193+
zend_long lval = 0;
194+
if (is_operator && Z_TYPE_P(arg) == IS_NULL) {
195+
return false;
196+
}
197+
if (!zend_parse_arg_long_weak(arg, &lval, arg_num)) {
198+
return false;
199+
}
200+
201+
mpz_set_si(*destination_mpz_ptr, lval);
202+
203+
return true;
204+
}
205+
191206
return false;
192207
}
193208

0 commit comments

Comments
 (0)