summaryrefslogtreecommitdiff
path: root/ext/gmp
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2007-11-01 00:46:13 +0000
committerStanislav Malyshev <stas@php.net>2007-11-01 00:46:13 +0000
commiteb5bd09cff364be2426b4a8785c3e703a48abeb8 (patch)
treeda0e688508f50c36f9414a58c00bdc442fefc149 /ext/gmp
parent2d8dc07e3e7c561c27f6e42babdc48f4a20e7475 (diff)
downloadphp-git-eb5bd09cff364be2426b4a8785c3e703a48abeb8.tar.gz
- Fix memory leaks (bug #42509)
- Fix _gmp_binary_opl - Use modern parameter parsing
Diffstat (limited to 'ext/gmp')
-rw-r--r--ext/gmp/gmp.c457
-rw-r--r--ext/gmp/tests/004.phpt2
-rw-r--r--ext/gmp/tests/005.phpt20
-rw-r--r--ext/gmp/tests/006.phpt10
-rw-r--r--ext/gmp/tests/007.phpt4
-rw-r--r--ext/gmp/tests/008.phpt4
-rw-r--r--ext/gmp/tests/009.phpt4
-rw-r--r--ext/gmp/tests/010.phpt4
-rw-r--r--ext/gmp/tests/011.phpt4
-rw-r--r--ext/gmp/tests/012.phpt4
-rw-r--r--ext/gmp/tests/013.phpt4
-rw-r--r--ext/gmp/tests/014.phpt4
-rw-r--r--ext/gmp/tests/015.phpt6
-rw-r--r--ext/gmp/tests/016.phpt6
-rw-r--r--ext/gmp/tests/017.phpt4
-rw-r--r--ext/gmp/tests/018.phpt2
-rw-r--r--ext/gmp/tests/019.phpt2
-rw-r--r--ext/gmp/tests/020.phpt2
-rw-r--r--ext/gmp/tests/021.phpt6
-rw-r--r--ext/gmp/tests/022.phpt6
-rw-r--r--ext/gmp/tests/023.phpt4
-rw-r--r--ext/gmp/tests/024.phpt19
-rw-r--r--ext/gmp/tests/025.phpt19
-rw-r--r--ext/gmp/tests/026.phpt6
-rw-r--r--ext/gmp/tests/027.phpt4
-rw-r--r--ext/gmp/tests/028.phpt14
-rw-r--r--ext/gmp/tests/029.phpt4
-rw-r--r--ext/gmp/tests/030.phpt4
-rw-r--r--ext/gmp/tests/031.phpt2
-rw-r--r--ext/gmp/tests/032.phpt4
-rw-r--r--ext/gmp/tests/033.phpt8
-rw-r--r--ext/gmp/tests/034.phpt6
-rw-r--r--ext/gmp/tests/035.phpt2
-rw-r--r--ext/gmp/tests/036.phpt4
-rw-r--r--ext/gmp/tests/037.phpt4
-rw-r--r--ext/gmp/tests/038.phpt4
-rw-r--r--ext/gmp/tests/039.phpt6
37 files changed, 335 insertions, 334 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 888806709a..2b547d5549 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -423,16 +423,23 @@ ZEND_MODULE_INFO_D(gmp)
/* Fetch zval to be GMP number.
Initially, zval can be also number or string */
-#define FETCH_GMP_ZVAL(gmpnumber, zval) \
-if (Z_TYPE_PP(zval) == IS_RESOURCE) { \
- ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp);\
-} else {\
- if (convert_to_gmp(&gmpnumber, zval, 0 TSRMLS_CC) == FAILURE) {\
- RETURN_FALSE;\
- }\
- ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp);\
+#define FETCH_GMP_ZVAL(gmpnumber, zval, tmp_resource) \
+if (Z_TYPE_PP(zval) == IS_RESOURCE) { \
+ ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp); \
+ tmp_resource = 0; \
+} else { \
+ if (convert_to_gmp(&gmpnumber, zval, 0 TSRMLS_CC) == FAILURE) { \
+ RETURN_FALSE; \
+ } \
+ tmp_resource = ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp); \
}
+#define FREE_GMP_TEMP(tmp_resource) \
+ if(tmp_resource) { \
+ zend_list_delete(tmp_resource); \
+ }
+
+
/* create a new initialized GMP number */
#define INIT_GMP_NUM(gmpnumber) { gmpnumber=emalloc(sizeof(mpz_t)); mpz_init(*gmpnumber); }
#define FREE_GMP_NUM(gmpnumber) { mpz_clear(*gmpnumber); efree(gmpnumber); }
@@ -524,13 +531,14 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
unsigned long long_result = 0;
int use_ui = 0;
+ int arga_tmp = 0, argb_tmp = 0;
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, arga_tmp);
if (gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
use_ui = 1;
} else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, argb_tmp);
}
if(check_b_zero) {
@@ -543,6 +551,8 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
if(b_is_zero) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero operand not allowed");
+ FREE_GMP_TEMP(arga_tmp);
+ FREE_GMP_TEMP(argb_tmp);
RETURN_FALSE;
}
}
@@ -559,6 +569,9 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
gmp_op(*gmpnum_result, *gmpnum_a, *gmpnum_b);
}
+ FREE_GMP_TEMP(arga_tmp);
+ FREE_GMP_TEMP(argb_tmp);
+
if (use_ui && allow_ui_return) {
FREE_GMP_NUM(gmpnum_result);
RETURN_LONG((long)long_result);
@@ -578,14 +591,15 @@ static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, z
zval r;
int use_ui = 0;
unsigned long long_result = 0;
+ int arga_tmp = 0, argb_tmp = 0;
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, arga_tmp);
if (gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
/* use _ui function */
use_ui = 1;
} else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, argb_tmp);
}
if(check_b_zero) {
@@ -598,6 +612,8 @@ static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, z
if(b_is_zero) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero operand not allowed");
+ FREE_GMP_TEMP(arga_tmp);
+ FREE_GMP_TEMP(argb_tmp);
RETURN_FALSE;
}
}
@@ -615,6 +631,9 @@ static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, z
gmp_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, *gmpnum_b);
}
+ FREE_GMP_TEMP(arga_tmp);
+ FREE_GMP_TEMP(argb_tmp);
+
array_init(return_value);
ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
add_index_resource(return_value, 0, Z_LVAL(r));
@@ -634,8 +653,8 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
{
zval **a_arg, **b_arg;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op);
@@ -649,12 +668,14 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
static inline void gmp_zval_unary_op(zval *return_value, zval **a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
{
mpz_t *gmpnum_a, *gmpnum_result;
+ int temp_a;
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
INIT_GMP_NUM(gmpnum_result);
gmp_op(*gmpnum_result, *gmpnum_a);
+ FREE_GMP_TEMP(temp_a);
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
}
/* }}} */
@@ -681,10 +702,10 @@ static inline void _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_ui_o
{
zval **a_arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
-
+
gmp_zval_unary_ui_op(return_value, a_arg, gmp_op);
}
/* }}} */
@@ -695,8 +716,8 @@ static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gm
{
zval **a_arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
gmp_zval_unary_op(return_value, a_arg, gmp_op TSRMLS_CC);
@@ -709,14 +730,15 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t
{
zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(gmp_op(*gmpnum_a));
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ RETVAL_LONG(gmp_op(*gmpnum_a));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -726,15 +748,19 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_
{
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b;
+ int temp_a, temp_b;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
+
+ RETVAL_LONG(gmp_op(*gmpnum_a, *gmpnum_b));
- RETURN_LONG(gmp_op(*gmpnum_a, *gmpnum_b));
+ FREE_GMP_TEMP(temp_a);
+ FREE_GMP_TEMP(temp_b);
}
/* }}} */
@@ -742,23 +768,17 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_
Initializes GMP number */
ZEND_FUNCTION(gmp_init)
{
- zval **number_arg, **base_arg;
+ zval **number_arg;
mpz_t * gmpnumber;
- int argc;
int base=0;
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &number_arg, &base_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &number_arg, &base) == FAILURE) {
+ return;
}
- if (argc == 2) {
- convert_to_long_ex(base_arg);
- base = Z_LVAL_PP(base_arg);
- if (base < 2 || base > 36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %d (should be between 2 and 36)", base);
- RETURN_FALSE;
- }
+ if (base && (base < 2 || base > 36)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %d (should be between 2 and 36)", base);
+ RETURN_FALSE;
}
if (convert_to_gmp(&gmpnumber, number_arg, base TSRMLS_CC) == FAILURE) {
@@ -777,8 +797,8 @@ ZEND_FUNCTION(gmp_intval)
zval **gmpnumber_arg;
mpz_t * gmpnum;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &gmpnumber_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &gmpnumber_arg) == FAILURE){
+ return;
}
if (Z_TYPE_PP(gmpnumber_arg) == IS_RESOURCE) {
@@ -795,26 +815,14 @@ ZEND_FUNCTION(gmp_intval)
Gets string representation of GMP number */
ZEND_FUNCTION(gmp_strval)
{
- zval **gmpnumber_arg, **base_arg;
- int base=10, num_len, argc;
+ zval **gmpnumber_arg;
+ int base=10, num_len;
mpz_t * gmpnum;
char *out_string;
+ int temp_a;
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &base_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum, gmpnumber_arg);
-
- switch (argc) {
- case 2:
- convert_to_long_ex(base_arg);
- base = Z_LVAL_PP(base_arg);
- break;
- case 1:
- base = 10;
- break;
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &gmpnumber_arg, &base ) == FAILURE ) {
+ return;
}
if (base < 2 || base > 36) {
@@ -822,13 +830,17 @@ ZEND_FUNCTION(gmp_strval)
RETURN_FALSE;
}
+ FETCH_GMP_ZVAL(gmpnum, gmpnumber_arg, temp_a);
+
num_len = mpz_sizeinbase(*gmpnum, base);
out_string = emalloc(num_len+2);
if (mpz_sgn(*gmpnum) < 0) {
num_len++;
}
mpz_get_str(out_string, base, *gmpnum);
-
+
+ FREE_GMP_TEMP(temp_a);
+
/*
From GMP documentation for mpz_sizeinbase():
The returned value will be exact or 1 too big. If base is a power of
@@ -874,22 +886,11 @@ ZEND_FUNCTION(gmp_mul)
Divide a by b, returns quotient and reminder */
ZEND_FUNCTION(gmp_div_qr)
{
- zval **a_arg, **b_arg, **round_arg;
- int round = GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
+ zval **a_arg, **b_arg;
+ int round = GMP_ROUND_ZERO;
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &a_arg, &b_arg, &round) == FAILURE) {
+ return;
}
switch (round) {
@@ -911,22 +912,11 @@ ZEND_FUNCTION(gmp_div_qr)
Divide a by b, returns reminder only */
ZEND_FUNCTION(gmp_div_r)
{
- zval **a_arg, **b_arg, **round_arg;
- int round = GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
+ zval **a_arg, **b_arg;
+ int round = GMP_ROUND_ZERO;
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &a_arg, &b_arg, &round) == FAILURE) {
+ return;
}
switch (round) {
@@ -947,22 +937,11 @@ ZEND_FUNCTION(gmp_div_r)
Divide a by b, returns quotient only */
ZEND_FUNCTION(gmp_div_q)
{
- zval **a_arg, **b_arg, **round_arg;
- int round = GMP_ROUND_ZERO, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
+ zval **a_arg, **b_arg;
+ int round = GMP_ROUND_ZERO;
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &a_arg, &b_arg, &round) == FAILURE) {
+ return;
}
switch (round) {
@@ -986,8 +965,8 @@ ZEND_FUNCTION(gmp_mod)
{
zval **a_arg, **b_arg;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_mod, (gmp_binary_ui_op_t)mpz_mod_ui, 1, 1 TSRMLS_CC);
@@ -1000,8 +979,8 @@ ZEND_FUNCTION(gmp_divexact)
{
zval **a_arg, **b_arg;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_divexact, NULL, 0, 1 TSRMLS_CC);
@@ -1030,21 +1009,22 @@ ZEND_FUNCTION(gmp_fact)
{
zval **a_arg;
mpz_t *gmpnum_tmp;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
if (Z_TYPE_PP(a_arg) == IS_RESOURCE) {
- FETCH_GMP_ZVAL(gmpnum_tmp, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_tmp, a_arg, temp_a); /* no need to free this since it's IS_RESOURCE */
if (mpz_sgn(*gmpnum_tmp) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Number has to be greater than or equal to 0");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
RETURN_FALSE;
}
} else {
convert_to_long_ex(a_arg);
if (Z_LVAL_PP(a_arg) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Number has to be greater than or equal to 0");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
RETURN_FALSE;
}
}
@@ -1060,15 +1040,16 @@ ZEND_FUNCTION(gmp_pow)
zval **base_arg, **exp_arg;
mpz_t *gmpnum_result, *gmpnum_base;
int use_ui = 0;
+ int temp_base;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &base_arg, &exp_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &base_arg, &exp_arg) == FAILURE){
+ return;
}
if (Z_TYPE_PP(base_arg) == IS_LONG && Z_LVAL_PP(base_arg) >= 0) {
use_ui = 1;
} else {
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
+ FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
}
convert_to_long_ex(exp_arg);
@@ -1084,7 +1065,7 @@ ZEND_FUNCTION(gmp_pow)
} else {
mpz_pow_ui(*gmpnum_result, *gmpnum_base, Z_LVAL_PP(exp_arg));
}
-
+ FREE_GMP_TEMP(temp_base);
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
}
/* }}} */
@@ -1096,25 +1077,29 @@ ZEND_FUNCTION(gmp_powm)
zval **base_arg, **exp_arg, **mod_arg;
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
int use_ui = 0;
+ int temp_base, temp_exp, temp_mod;
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &base_arg, &exp_arg, &mod_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
+ FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
if (Z_TYPE_PP(exp_arg) == IS_LONG && Z_LVAL_PP(exp_arg) >= 0) {
use_ui = 1;
} else {
- FETCH_GMP_ZVAL(gmpnum_exp, exp_arg);
+ FETCH_GMP_ZVAL(gmpnum_exp, exp_arg, temp_exp);
if (mpz_sgn(*gmpnum_exp) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Second parameter cannot be less than 0");
RETURN_FALSE;
}
}
- FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
+ FETCH_GMP_ZVAL(gmpnum_mod, mod_arg, temp_mod);
if (!mpz_cmp_ui(*gmpnum_mod, 0)) {
+ FREE_GMP_TEMP(temp_base);
+ FREE_GMP_TEMP(temp_exp);
+ FREE_GMP_TEMP(temp_mod);
RETURN_FALSE;
}
@@ -1125,6 +1110,10 @@ ZEND_FUNCTION(gmp_powm)
mpz_powm(*gmpnum_result, *gmpnum_base, *gmpnum_exp, *gmpnum_mod);
}
+ FREE_GMP_TEMP(temp_base);
+ FREE_GMP_TEMP(temp_exp);
+ FREE_GMP_TEMP(temp_mod);
+
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
}
@@ -1136,20 +1125,23 @@ ZEND_FUNCTION(gmp_sqrt)
{
zval **a_arg;
mpz_t *gmpnum_a, *gmpnum_result;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
if (mpz_sgn(*gmpnum_a) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Number has to be greater than or equal to 0");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
+ FREE_GMP_TEMP(temp_a);
RETURN_FALSE;
}
INIT_GMP_NUM(gmpnum_result);
mpz_sqrt(*gmpnum_result, *gmpnum_a);
+ FREE_GMP_TEMP(temp_a);
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
}
@@ -1162,12 +1154,13 @@ ZEND_FUNCTION(gmp_sqrtrem)
zval **a_arg;
mpz_t *gmpnum_a, *gmpnum_result1, *gmpnum_result2;
zval r;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
if (mpz_sgn(*gmpnum_a) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Number has to be greater than or equal to 0");
@@ -1178,6 +1171,7 @@ ZEND_FUNCTION(gmp_sqrtrem)
INIT_GMP_NUM(gmpnum_result2);
mpz_sqrtrem(*gmpnum_result1, *gmpnum_result2, *gmpnum_a);
+ FREE_GMP_TEMP(temp_a);
array_init(return_value);
ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
@@ -1193,14 +1187,16 @@ ZEND_FUNCTION(gmp_perfect_square)
{
zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETURN_BOOL((mpz_perfect_square_p(*gmpnum_a)!=0));
+ RETVAL_BOOL((mpz_perfect_square_p(*gmpnum_a)!=0));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1208,28 +1204,19 @@ ZEND_FUNCTION(gmp_perfect_square)
Checks if a is "probably prime" */
ZEND_FUNCTION(gmp_prob_prime)
{
- zval **gmpnumber_arg, **reps_arg;
+ zval **gmpnumber_arg;
mpz_t *gmpnum_a;
- int argc, reps = 10;
+ int reps = 10;
+ int temp_a;
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &reps_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &gmpnumber_arg, &reps) == FAILURE) {
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a);
- switch (argc) {
- case 2:
- convert_to_long_ex(reps_arg);
- reps = Z_LVAL_PP(reps_arg);
- break;
- case 1:
- reps = 10;
- break;
- }
-
- RETURN_LONG(mpz_probab_prime_p(*gmpnum_a, reps));
+ RETVAL_LONG(mpz_probab_prime_p(*gmpnum_a, reps));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1239,8 +1226,8 @@ ZEND_FUNCTION(gmp_gcd)
{
zval **a_arg, **b_arg;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_gcd, (gmp_binary_ui_op_t)mpz_gcd_ui, 1, 0 TSRMLS_CC);
@@ -1254,19 +1241,22 @@ ZEND_FUNCTION(gmp_gcdext)
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_t, *gmpnum_s, *gmpnum_g;
zval r;
+ int temp_a, temp_b;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
INIT_GMP_NUM(gmpnum_g);
INIT_GMP_NUM(gmpnum_s);
INIT_GMP_NUM(gmpnum_t);
mpz_gcdext(*gmpnum_g, *gmpnum_s, *gmpnum_t, *gmpnum_a, *gmpnum_b);
+ FREE_GMP_TEMP(temp_a);
+ FREE_GMP_TEMP(temp_b);
array_init(return_value);
@@ -1285,16 +1275,21 @@ ZEND_FUNCTION(gmp_invert)
{
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
+ int temp_a, temp_b;
+ int res;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
INIT_GMP_NUM(gmpnum_result);
- if (mpz_invert(*gmpnum_result, *gmpnum_a, *gmpnum_b)) {
+ res=mpz_invert(*gmpnum_result, *gmpnum_a, *gmpnum_b);
+ FREE_GMP_TEMP(temp_a);
+ FREE_GMP_TEMP(temp_b);
+ if (res) {
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
} else {
FREE_GMP_NUM(gmpnum_result);
@@ -1326,17 +1321,18 @@ ZEND_FUNCTION(gmp_cmp)
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b;
int use_si = 0, res;
+ int temp_a, temp_b;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
if (Z_TYPE_PP(b_arg) == IS_LONG) {
use_si = 1;
} else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
}
if (use_si) {
@@ -1344,6 +1340,7 @@ ZEND_FUNCTION(gmp_cmp)
} else {
res = mpz_cmp(*gmpnum_a, *gmpnum_b);
}
+ FREE_GMP_TEMP(temp_a);
RETURN_LONG(res);
}
@@ -1355,14 +1352,16 @@ ZEND_FUNCTION(gmp_sign)
{
zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETURN_LONG(mpz_sgn(*gmpnum_a));
+ RETVAL_LONG(mpz_sgn(*gmpnum_a));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1370,19 +1369,11 @@ ZEND_FUNCTION(gmp_sign)
Gets random number */
ZEND_FUNCTION(gmp_random)
{
- zval **limiter_arg;
- int limiter, argc;
+ int limiter = 20;
mpz_t *gmpnum_result;
- argc = ZEND_NUM_ARGS();
-
- if (argc == 0) {
- limiter = 20;
- } else if (argc == 1 && zend_get_parameters_ex(1, &limiter_arg) == SUCCESS) {
- convert_to_long_ex(limiter_arg);
- limiter = Z_LVAL_PP(limiter_arg);
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limiter) == FAILURE) {
+ return;
}
INIT_GMP_NUM(gmpnum_result);
@@ -1441,13 +1432,14 @@ ZEND_FUNCTION(gmp_xor)
/* use formula: a^b = (a|b)&^(a&b) */
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result, *gmpnum_t;
+ int temp_a, temp_b;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
INIT_GMP_NUM(gmpnum_result);
INIT_GMP_NUM(gmpnum_t);
@@ -1460,6 +1452,8 @@ ZEND_FUNCTION(gmp_xor)
FREE_GMP_NUM(gmpnum_t);
+ FREE_GMP_TEMP(temp_a);
+ FREE_GMP_TEMP(temp_b);
ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
}
/* }}} */
@@ -1468,30 +1462,16 @@ ZEND_FUNCTION(gmp_xor)
Sets or clear bit in a */
ZEND_FUNCTION(gmp_setbit)
{
- zval **a_arg, **ind_arg, **set_c_arg;
- int argc, index, set = 1;
+ zval **a_arg;
+ int index, set = 1;
mpz_t *gmpnum_a;
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &ind_arg, &set_c_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl|b", &a_arg, &index, &set) == FAILURE) {
+ return;
}
ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
- switch (argc) {
- case 3:
- convert_to_long_ex(set_c_arg);
- set = Z_LVAL_PP(set_c_arg);
- break;
- case 2:
- set = 1;
- break;
- }
-
if (index < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero");
return;
@@ -1509,19 +1489,16 @@ ZEND_FUNCTION(gmp_setbit)
Clears bit in a */
ZEND_FUNCTION(gmp_clrbit)
{
- zval **a_arg, **ind_arg;
+ zval **a_arg;
int index;
mpz_t *gmpnum_a;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &ind_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl", &a_arg, &index) == FAILURE){
+ return;
}
ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
if (index < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero");
return;
@@ -1537,14 +1514,16 @@ ZEND_FUNCTION(gmp_popcount)
{
zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a_arg) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETURN_LONG(mpz_popcount(*gmpnum_a));
+ RETVAL_LONG(mpz_popcount(*gmpnum_a));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1554,15 +1533,18 @@ ZEND_FUNCTION(gmp_hamdist)
{
zval **a_arg, **b_arg;
mpz_t *gmpnum_a, *gmpnum_b;
+ int temp_a, temp_b;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &a_arg, &b_arg) == FAILURE){
+ return;
}
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- RETURN_LONG(mpz_hamdist(*gmpnum_a, *gmpnum_b));
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ FETCH_GMP_ZVAL(gmpnum_b, b_arg, temp_b);
+
+ RETVAL_LONG(mpz_hamdist(*gmpnum_a, *gmpnum_b));
+ FREE_GMP_TEMP(temp_a);
+ FREE_GMP_TEMP(temp_b);
}
/* }}} */
@@ -1570,22 +1552,24 @@ ZEND_FUNCTION(gmp_hamdist)
Finds first zero bit */
ZEND_FUNCTION(gmp_scan0)
{
- zval **a_arg, **start_arg;
+ zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
+ int start;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl", &a_arg, &start) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- if (Z_LVAL_PP(start_arg) < 0) {
+ if (start < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero");
RETURN_FALSE;
}
- RETURN_LONG(mpz_scan0(*gmpnum_a, Z_LVAL_PP(start_arg)));
+ RETVAL_LONG(mpz_scan0(*gmpnum_a, start));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1593,22 +1577,23 @@ ZEND_FUNCTION(gmp_scan0)
Finds first non-zero bit */
ZEND_FUNCTION(gmp_scan1)
{
- zval **a_arg, **start_arg;
+ zval **a_arg;
mpz_t *gmpnum_a;
+ int temp_a;
+ int start;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl", &a_arg, &start) == FAILURE){
+ return;
}
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
-
- if (Z_LVAL_PP(start_arg) < 0) {
+ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
+ if (start < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero");
RETURN_FALSE;
}
- RETURN_LONG(mpz_scan1(*gmpnum_a, Z_LVAL_PP(start_arg)));
+ RETVAL_LONG(mpz_scan1(*gmpnum_a, start));
+ FREE_GMP_TEMP(temp_a);
}
/* }}} */
diff --git a/ext/gmp/tests/004.phpt b/ext/gmp/tests/004.phpt
index d093c04d59..a0fa1cd133 100644
--- a/ext/gmp/tests/004.phpt
+++ b/ext/gmp/tests/004.phpt
@@ -25,7 +25,7 @@ var_dump(gmp_intval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_intval() in %s on line %d
+Warning: gmp_intval() expects exactly 1 parameter, 2 given in %s on line %d
NULL
int(0)
int(1)
diff --git a/ext/gmp/tests/005.phpt b/ext/gmp/tests/005.phpt
index 482e7217ad..806b5e6e34 100644
--- a/ext/gmp/tests/005.phpt
+++ b/ext/gmp/tests/005.phpt
@@ -28,19 +28,25 @@ var_dump(gmp_strval($g, 10));
var_dump(gmp_strval(array(1,2), array(1,2)));
var_dump(gmp_strval(new stdclass, new stdclass));
+var_dump(gmp_strval(array(1,2)));
+var_dump(gmp_strval(new stdclass));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_strval() in %s on line %d
+Warning: gmp_strval() expects at least 1 parameter, 0 given in %s on line %d
NULL
bool(false)
-bool(false)
-bool(false)
-Warning: gmp_strval(): Bad base for conversion: 0 in %s on line %d
+Warning: gmp_strval() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: gmp_strval(): Bad base for conversion: -1 in %s on line %d
bool(false)
+Warning: gmp_strval() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
Warning: gmp_strval(): supplied resource is not a valid GMP integer resource in %s on line %d
bool(false)
string(7) "9765456"
@@ -60,6 +66,12 @@ Warning: gmp_strval(): Bad base for conversion: 100000 in %s on line %d
bool(false)
string(8) "-3373333"
+Warning: gmp_strval() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gmp_strval() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/006.phpt b/ext/gmp/tests/006.phpt
index 2e207c197b..2178d6732f 100644
--- a/ext/gmp/tests/006.phpt
+++ b/ext/gmp/tests/006.phpt
@@ -23,21 +23,21 @@ var_dump(gmp_strval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_sub() in %s on line %d
+Warning: gmp_sub() expects exactly 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_sub() in %s on line %d
+Warning: gmp_sub() expects exactly 2 parameters, 1 given in %s on line %d
NULL
bool(false)
-Warning: Wrong parameter count for gmp_sub() in %s on line %d
+Warning: gmp_sub() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-resource(%d) of type (GMP integer)
+resource(5) of type (GMP integer)
string(2) "-1"
-resource(%d) of type (GMP integer)
+resource(8) of type (GMP integer)
string(5) "10001"
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/007.phpt b/ext/gmp/tests/007.phpt
index d699816103..4d4a993a17 100644
--- a/ext/gmp/tests/007.phpt
+++ b/ext/gmp/tests/007.phpt
@@ -45,10 +45,10 @@ var_dump(gmp_div_qr(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_div_qr() in %s on line %d
+Warning: gmp_div_qr() expects at least 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_div_qr() in %s on line %d
+Warning: gmp_div_qr() expects at least 2 parameters, 1 given in %s on line %d
NULL
array(2) {
[0]=>
diff --git a/ext/gmp/tests/008.phpt b/ext/gmp/tests/008.phpt
index 773719ec4d..4e44ec10bf 100644
--- a/ext/gmp/tests/008.phpt
+++ b/ext/gmp/tests/008.phpt
@@ -36,10 +36,10 @@ var_dump(gmp_div_r(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_div_r() in %s on line %d
+Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_div_r() in %s on line %d
+Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d
NULL
int(0)
string(1) "0"
diff --git a/ext/gmp/tests/009.phpt b/ext/gmp/tests/009.phpt
index 559cc17f2d..745a4ef638 100644
--- a/ext/gmp/tests/009.phpt
+++ b/ext/gmp/tests/009.phpt
@@ -36,10 +36,10 @@ var_dump(gmp_div_q(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_div_q() in %s on line %d
+Warning: gmp_div_q() expects at least 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_div_q() in %s on line %d
+Warning: gmp_div_q() expects at least 2 parameters, 1 given in %s on line %d
NULL
resource(%d) of type (GMP integer)
string(1) "0"
diff --git a/ext/gmp/tests/010.phpt b/ext/gmp/tests/010.phpt
index 5ddc2c53c9..293a2a0bf2 100644
--- a/ext/gmp/tests/010.phpt
+++ b/ext/gmp/tests/010.phpt
@@ -22,10 +22,10 @@ var_dump(gmp_mod($a, $b));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_mod() in %s on line %d
+Warning: gmp_mod() expects exactly 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_mod() in %s on line %d
+Warning: gmp_mod() expects exactly 2 parameters, 1 given in %s on line %d
NULL
bool(false)
int(0)
diff --git a/ext/gmp/tests/011.phpt b/ext/gmp/tests/011.phpt
index 0ca3ca3849..b413aa9624 100644
--- a/ext/gmp/tests/011.phpt
+++ b/ext/gmp/tests/011.phpt
@@ -39,10 +39,10 @@ var_dump(gmp_strval($r));
echo "Done\n";
?>
--EXPECTF--
-Warning: Wrong parameter count for gmp_divexact() in %s on line %d
+Warning: gmp_divexact() expects exactly 2 parameters, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_divexact() in %s on line %d
+Warning: gmp_divexact() expects exactly 2 parameters, 0 given in %s on line %d
NULL
string(1) "0"
diff --git a/ext/gmp/tests/012.phpt b/ext/gmp/tests/012.phpt
index a8de915980..8582ba1fd3 100644
--- a/ext/gmp/tests/012.phpt
+++ b/ext/gmp/tests/012.phpt
@@ -33,10 +33,10 @@ int(0)
int(0)
string(21) "-12345678901234567890"
-Warning: Wrong parameter count for gmp_neg() in %s on line %d
+Warning: gmp_neg() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_neg() in %s on line %d
+Warning: gmp_neg() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/013.phpt b/ext/gmp/tests/013.phpt
index 8d6e1d0d59..06c2d818d5 100644
--- a/ext/gmp/tests/013.phpt
+++ b/ext/gmp/tests/013.phpt
@@ -34,10 +34,10 @@ string(1) "0"
string(1) "0"
string(1) "0"
-Warning: Wrong parameter count for gmp_abs() in %s on line %d
+Warning: gmp_abs() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_abs() in %s on line %d
+Warning: gmp_abs() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Warning: gmp_abs(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/014.phpt b/ext/gmp/tests/014.phpt
index f52c32cdb3..40e10c6fbe 100644
--- a/ext/gmp/tests/014.phpt
+++ b/ext/gmp/tests/014.phpt
@@ -48,10 +48,10 @@ string(11) "87178291200"
Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
string(1) "0"
-Warning: Wrong parameter count for gmp_fact() in %s on line %d
+Warning: gmp_fact() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_fact() in %s on line %d
+Warning: gmp_fact() expects exactly 1 parameter, 2 given in %s on line %d
NULL
resource(%d) of type (GMP integer)
string(1) "1"
diff --git a/ext/gmp/tests/015.phpt b/ext/gmp/tests/015.phpt
index 98ae349b59..b787a21b58 100644
--- a/ext/gmp/tests/015.phpt
+++ b/ext/gmp/tests/015.phpt
@@ -48,13 +48,13 @@ string(1) "0"
string(14) "10240000000000"
string(14) "10240000000000"
-Warning: Wrong parameter count for gmp_pow() in %s on line %d
+Warning: gmp_pow() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_pow() in %s on line %d
+Warning: gmp_pow() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_pow() in %s on line %d
+Warning: gmp_pow() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: gmp_pow(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/016.phpt b/ext/gmp/tests/016.phpt
index 6bd3afd070..44360865ca 100644
--- a/ext/gmp/tests/016.phpt
+++ b/ext/gmp/tests/016.phpt
@@ -58,13 +58,13 @@ bool(false)
Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_powm() in %s on line %d
+Warning: gmp_powm() expects exactly 3 parameters, 2 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_powm() in %s on line %d
+Warning: gmp_powm() expects exactly 3 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_powm() in %s on line %d
+Warning: gmp_powm() expects exactly 3 parameters, 0 given in %s on line %d
NULL
Warning: gmp_powm(): Second parameter cannot be less than 0 in %s on line %d
diff --git a/ext/gmp/tests/017.phpt b/ext/gmp/tests/017.phpt
index 8349862b7d..d90f538213 100644
--- a/ext/gmp/tests/017.phpt
+++ b/ext/gmp/tests/017.phpt
@@ -39,10 +39,10 @@ Warning: gmp_sqrt(): Number has to be greater than or equal to 0 in %s on line %
string(1) "0"
string(2) "27"
-Warning: Wrong parameter count for gmp_sqrt() in %s on line %d
+Warning: gmp_sqrt() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_sqrt() in %s on line %d
+Warning: gmp_sqrt() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: gmp_sqrt(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/018.phpt b/ext/gmp/tests/018.phpt
index c8146cf95c..2fca463daa 100644
--- a/ext/gmp/tests/018.phpt
+++ b/ext/gmp/tests/018.phpt
@@ -95,6 +95,6 @@ string(1) "1"
Warning: gmp_sqrtrem(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_sqrtrem() in %s on line %d
+Warning: gmp_sqrtrem() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/019.phpt b/ext/gmp/tests/019.phpt
index 10bca880b8..aa596ba9cd 100644
--- a/ext/gmp/tests/019.phpt
+++ b/ext/gmp/tests/019.phpt
@@ -39,7 +39,7 @@ bool(false)
bool(true)
bool(false)
-Warning: Wrong parameter count for gmp_perfect_square() in %s on line %d
+Warning: gmp_perfect_square() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: gmp_perfect_square(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/020.phpt b/ext/gmp/tests/020.phpt
index c689ec552c..f8f3e6921c 100644
--- a/ext/gmp/tests/020.phpt
+++ b/ext/gmp/tests/020.phpt
@@ -73,7 +73,7 @@ int(0)
int(0)
int(0)
-Warning: Wrong parameter count for gmp_prob_prime() in %s on line %d
+Warning: gmp_prob_prime() expects at least 1 parameter, 0 given in %s on line %d
NULL
Warning: gmp_prob_prime(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/021.phpt b/ext/gmp/tests/021.phpt
index 01b4d1cd68..3ec947d640 100644
--- a/ext/gmp/tests/021.phpt
+++ b/ext/gmp/tests/021.phpt
@@ -40,12 +40,12 @@ string(1) "1"
string(10) "8127346234"
string(1) "0"
-Warning: Wrong parameter count for gmp_gcd() in %s on line %d
+Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_gcd() in %s on line %d
+Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_gcd() in %s on line %d
+Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/022.phpt
index cfa919bf6f..805c9b6753 100644
--- a/ext/gmp/tests/022.phpt
+++ b/ext/gmp/tests/022.phpt
@@ -74,12 +74,12 @@ bool(false)
Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_gcdext() in %s on line %d
+Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_gcdext() in %s on line %d
+Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_gcdext() in %s on line %d
+Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/023.phpt b/ext/gmp/tests/023.phpt
index a7cc9a7a8f..81a90fe16a 100644
--- a/ext/gmp/tests/023.phpt
+++ b/ext/gmp/tests/023.phpt
@@ -38,10 +38,10 @@ string(1) "0"
string(22) "3498273496234234523441"
string(1) "1"
-Warning: Wrong parameter count for gmp_invert() in %s on line %d
+Warning: gmp_invert() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_invert() in %s on line %d
+Warning: gmp_invert() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/024.phpt b/ext/gmp/tests/024.phpt
index 9b46d94837..f7d8d6f777 100644
--- a/ext/gmp/tests/024.phpt
+++ b/ext/gmp/tests/024.phpt
@@ -35,20 +35,19 @@ string(1) "0"
string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-int(0)
+string(2) "-1"
Warning: gmp_jacobi(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
@@ -56,12 +55,12 @@ bool(false)
Warning: gmp_jacobi(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_jacobi() in %s on line %d
+Warning: gmp_jacobi() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_jacobi() in %s on line %d
+Warning: gmp_jacobi() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_jacobi() in %s on line %d
+Warning: gmp_jacobi() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/025.phpt b/ext/gmp/tests/025.phpt
index 99ac184df8..ec8bb8c24c 100644
--- a/ext/gmp/tests/025.phpt
+++ b/ext/gmp/tests/025.phpt
@@ -35,20 +35,19 @@ string(1) "0"
string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
+string(2) "-1"
string(1) "0"
string(1) "0"
+string(2) "-1"
string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-string(1) "0"
-int(0)
+string(2) "-1"
Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
@@ -56,12 +55,12 @@ bool(false)
Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_legendre() in %s on line %d
+Warning: gmp_legendre() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_legendre() in %s on line %d
+Warning: gmp_legendre() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_legendre() in %s on line %d
+Warning: gmp_legendre() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/026.phpt b/ext/gmp/tests/026.phpt
index d952622875..3c7cce8ae5 100644
--- a/ext/gmp/tests/026.phpt
+++ b/ext/gmp/tests/026.phpt
@@ -34,15 +34,15 @@ int(-1)
int(-2)
int(0)
-Warning: Wrong parameter count for gmp_cmp() in %s on line %d
+Warning: gmp_cmp() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_cmp() in %s on line %d
+Warning: gmp_cmp() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_cmp() in %s on line %d
+Warning: gmp_cmp() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/027.phpt b/ext/gmp/tests/027.phpt
index d4fee571f7..71204db98b 100644
--- a/ext/gmp/tests/027.phpt
+++ b/ext/gmp/tests/027.phpt
@@ -28,12 +28,12 @@ int(-1)
bool(false)
int(0)
-Warning: Wrong parameter count for gmp_sign() in %s on line %d
+Warning: gmp_sign() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Warning: gmp_sign(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_sign() in %s on line %d
+Warning: gmp_sign() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/028.phpt b/ext/gmp/tests/028.phpt
index a61a39a07d..3a876aa60c 100644
--- a/ext/gmp/tests/028.phpt
+++ b/ext/gmp/tests/028.phpt
@@ -26,10 +26,16 @@ string(1) "%d"
string(%d) "%d"
string(%d) "%d"
string(%d) "%d"
-resource(%d) of type (GMP integer)
-Warning: Wrong parameter count for gmp_random() in %s on line %d
+Warning: gmp_random() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: gmp_random() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: gmp_random() expects parameter 1 to be long, string given in %s on line %d
NULL
-resource(%d) of type (GMP integer)
-resource(%d) of type (GMP integer)
Done
diff --git a/ext/gmp/tests/029.phpt b/ext/gmp/tests/029.phpt
index 0846ad1356..1b86e47fd9 100644
--- a/ext/gmp/tests/029.phpt
+++ b/ext/gmp/tests/029.phpt
@@ -35,10 +35,10 @@ string(1) "0"
string(4) "1536"
string(15) "424703623692768"
-Warning: Wrong parameter count for gmp_and() in %s on line %d
+Warning: gmp_and() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_and() in %s on line %d
+Warning: gmp_and() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/030.phpt b/ext/gmp/tests/030.phpt
index 86c5caeea4..633af41e6f 100644
--- a/ext/gmp/tests/030.phpt
+++ b/ext/gmp/tests/030.phpt
@@ -35,10 +35,10 @@ string(1) "0"
string(15) "987657876576252"
string(21) "987658441719689394144"
-Warning: Wrong parameter count for gmp_or() in %s on line %d
+Warning: gmp_or() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_or() in %s on line %d
+Warning: gmp_or() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: gmp_or(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/031.phpt b/ext/gmp/tests/031.phpt
index 80a7ff89cb..90ce1759da 100644
--- a/ext/gmp/tests/031.phpt
+++ b/ext/gmp/tests/031.phpt
@@ -37,7 +37,7 @@ string(12) "-98765463338"
Warning: gmp_com(): Unable to convert variable to GMP - wrong type in %s on line %d
string(1) "0"
-Warning: Wrong parameter count for gmp_com() in %s on line %d
+Warning: gmp_com() expects exactly 1 parameter, 0 given in %s on line %d
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/032.phpt b/ext/gmp/tests/032.phpt
index 4f426aac16..327c979da6 100644
--- a/ext/gmp/tests/032.phpt
+++ b/ext/gmp/tests/032.phpt
@@ -35,10 +35,10 @@ string(1) "0"
string(15) "987657876574716"
string(21) "987658017016065701376"
-Warning: Wrong parameter count for gmp_xor() in %s on line %d
+Warning: gmp_xor() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_xor() in %s on line %d
+Warning: gmp_xor() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: gmp_xor(): Unable to convert variable to GMP - wrong type in %s on line %d
diff --git a/ext/gmp/tests/033.phpt b/ext/gmp/tests/033.phpt
index ea5cc5da7c..38ff5be5bf 100644
--- a/ext/gmp/tests/033.phpt
+++ b/ext/gmp/tests/033.phpt
@@ -54,11 +54,11 @@ string(12) "100000000008"
Warning: gmp_setbit(): supplied argument is not a valid GMP integer resource in %s on line %d
-Warning: Wrong parameter count for gmp_setbit() in %s on line %d
+Warning: gmp_setbit() expects at least 2 parameters, 1 given in %s on line %d
-Warning: Wrong parameter count for gmp_setbit() in %s on line %d
+Warning: gmp_setbit() expects at most 3 parameters, 4 given in %s on line %d
-Warning: gmp_setbit(): supplied argument is not a valid GMP integer resource in %s on line %d
+Warning: gmp_setbit() expects parameter 2 to be long, array given in %s on line %d
-Warning: gmp_setbit(): supplied argument is not a valid GMP integer resource in %s on line %d
+Warning: gmp_setbit() expects parameter 2 to be long, array given in %s on line %d
Done
diff --git a/ext/gmp/tests/034.phpt b/ext/gmp/tests/034.phpt
index 1614c00160..6011029905 100644
--- a/ext/gmp/tests/034.phpt
+++ b/ext/gmp/tests/034.phpt
@@ -48,9 +48,9 @@ string(30) "238462734628347239571822592658"
Warning: gmp_clrbit(): supplied argument is not a valid GMP integer resource in %s on line %d
-Warning: Wrong parameter count for gmp_clrbit() in %s on line %d
+Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d
-Warning: Wrong parameter count for gmp_clrbit() in %s on line %d
+Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d
-Warning: Wrong parameter count for gmp_clrbit() in %s on line %d
+Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d
Done
diff --git a/ext/gmp/tests/035.phpt b/ext/gmp/tests/035.phpt
index a9b0c1a332..4b45a04481 100644
--- a/ext/gmp/tests/035.phpt
+++ b/ext/gmp/tests/035.phpt
@@ -28,6 +28,6 @@ int(20)
Warning: gmp_popcount(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_popcount() in %s on line %d
+Warning: gmp_popcount() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/036.phpt b/ext/gmp/tests/036.phpt
index fa2d67c822..c21e03ccb2 100644
--- a/ext/gmp/tests/036.phpt
+++ b/ext/gmp/tests/036.phpt
@@ -33,7 +33,7 @@ int(43)
int(0)
int(26)
-Warning: Wrong parameter count for gmp_hamdist() in %s on line %d
+Warning: gmp_hamdist() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
@@ -45,6 +45,6 @@ bool(false)
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_hamdist() in %s on line %d
+Warning: gmp_hamdist() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/037.phpt b/ext/gmp/tests/037.phpt
index 4789043029..2a87a968a2 100644
--- a/ext/gmp/tests/037.phpt
+++ b/ext/gmp/tests/037.phpt
@@ -32,9 +32,9 @@ int(13)
Warning: gmp_scan0(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_scan0() in %s on line %d
+Warning: gmp_scan0() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_scan0() in %s on line %d
+Warning: gmp_scan0() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/038.phpt b/ext/gmp/tests/038.phpt
index b278c2586c..7ebce9be7d 100644
--- a/ext/gmp/tests/038.phpt
+++ b/ext/gmp/tests/038.phpt
@@ -32,9 +32,9 @@ int(10)
Warning: gmp_scan1(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_scan1() in %s on line %d
+Warning: gmp_scan1() expects exactly 2 parameters, 1 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_scan1() in %s on line %d
+Warning: gmp_scan1() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
diff --git a/ext/gmp/tests/039.phpt b/ext/gmp/tests/039.phpt
index 3f373a84fc..9864cde4cc 100644
--- a/ext/gmp/tests/039.phpt
+++ b/ext/gmp/tests/039.phpt
@@ -21,15 +21,15 @@ echo "Done\n";
resource(%d) of type (GMP integer)
string(8) "98765678"
-Warning: Wrong parameter count for gmp_init() in %s on line %d
+Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: Wrong parameter count for gmp_init() in %s on line %d
+Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for gmp_init() in %s on line %d
+Warning: gmp_init() expects at most 2 parameters, 4 given in %s on line %d
NULL
Warning: gmp_init(): Bad base for conversion: -1 (should be between 2 and 36) in %s on line %d