From: Nikita Popov Date: Tue, 11 Mar 2014 12:28:26 +0000 (+0100) Subject: Add tests for bug #66872 and gmp_[rem]root X-Git-Tag: php-5.6.0beta1~3^2~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a117e6b93740e1c05ba8926c3f8938a9ad0cb631;p=php Add tests for bug #66872 and gmp_[rem]root --- diff --git a/ext/gmp/tests/041.phpt b/ext/gmp/tests/041.phpt new file mode 100644 index 0000000000..6e6d959288 --- /dev/null +++ b/ext/gmp/tests/041.phpt @@ -0,0 +1,147 @@ +--TEST-- +gmp_root() and gmp_rootrem() basic tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +object(GMP)#%d (1) { + ["num"]=> + string(2) "10" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "4" +} +object(GMP)#%d (1) { + ["num"]=> + string(2) "-4" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "5" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "3" +} + +Warning: gmp_root(): Can't take even root of negative number in %s on line %d +bool(false) +object(GMP)#%d (1) { + ["num"]=> + string(1) "0" +} + +Warning: gmp_root(): The root must be positive in %s on line %d +bool(false) + +Warning: gmp_root(): The root must be positive in %s on line %d +bool(false) +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "10" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "4" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "36" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "-4" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "36" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "5" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(3) "375" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "3" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "19" + } +} + +Warning: gmp_rootrem(): Can't take even root of negative number in %s on line %d +bool(false) +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } +} + +Warning: gmp_rootrem(): The root must be positive in %s on line %d +bool(false) + +Warning: gmp_rootrem(): The root must be positive in %s on line %d +bool(false) diff --git a/ext/gmp/tests/bug66872.phpt b/ext/gmp/tests/bug66872.phpt new file mode 100644 index 0000000000..715b7bae55 --- /dev/null +++ b/ext/gmp/tests/bug66872.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #66872: Crash when passing string to gmp_testbit +--FILE-- + +--EXPECTF-- +Warning: gmp_testbit(): Unable to convert variable to GMP - string is not an integer in %s on line %d +bool(false)