diff options
author | Anatol Belski <ab@php.net> | 2014-03-11 11:51:35 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-03-11 11:51:35 +0100 |
commit | 72050af85538ff1d1b56480dfa2d2d9f7f94b016 (patch) | |
tree | b8ab4ba3c1ea11f97c10f34547be18a16149c1da /ext/gmp | |
parent | 3a8282ed0fb26c3824a24351d4ed6eaf0da26871 (diff) | |
parent | 1a624e27a640f776db63934eddbbb50f634e2144 (diff) | |
download | php-git-72050af85538ff1d1b56480dfa2d2d9f7f94b016.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
restored the old code in 5.4/5 related to bug #66872
Diffstat (limited to 'ext/gmp')
-rw-r--r-- | ext/gmp/gmp.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 134cc4819a..f51bd8c59c 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1511,23 +1511,26 @@ ZEND_FUNCTION(gmp_clrbit) Tests if bit is set in a */ ZEND_FUNCTION(gmp_testbit) { - zval *a_arg; + zval **a_arg; long index; - mpz_ptr gmpnum_a; - gmp_temp_t temp_a; + mpz_t *gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &index) == FAILURE){ + 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); + if (index < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); RETURN_FALSE; } - FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_BOOL(mpz_tstbit(gmpnum_a, index)); - FREE_GMP_TEMP(temp_a); + if (mpz_tstbit(*gmpnum_a, index)) { + RETURN_TRUE; + } + + RETURN_FALSE; } /* }}} */ |