summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-09-12 11:25:21 +0800
committerXinchen Hui <laruence@gmail.com>2017-09-12 11:25:21 +0800
commitff6f41c94e38cb418a4466a236b0afabe222552f (patch)
treef03703f25f4d4dd6f042dd8a06ef018005f7d5fc /ext/standard
parent0d890025ec338b767afd8433d3d852d7a4bba1d8 (diff)
downloadphp-git-ff6f41c94e38cb418a4466a236b0afabe222552f.tar.gz
Narrow typeinfos down for zend_parse_paramenters_none
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/lcg.c3
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt24
2 files changed, 16 insertions, 11 deletions
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index af826c547b..f8b7e8d340 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -118,6 +118,9 @@ PHP_MINIT_FUNCTION(lcg) /* {{{ */
Returns a value from the combined linear congruential generator */
PHP_FUNCTION(lcg_value)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_DOUBLE(php_combined_lcg());
}
/* }}} */
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
index 6d624d84ab..8fc95190c6 100644
--- a/ext/standard/tests/math/lcg_value_basic.phpt
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -21,36 +21,38 @@ if ($i != 100) {
echo "PASSED\n";
}
-echo "\n lcg_value error cases..spurious args get ignored\n";
+echo "\n lcg_value error cases..\n";
$res = lcg_value(23);
-if (!is_float($res) || $res < 0 || $res > 1) {
- echo "FAILED\n";
-} else {
+if (is_null($res)) {
echo "PASSED\n";
+} else {
+ echo "FAILED\n";
}
$res = lcg_value(10,false);
-if (!is_float($res) || $res < 0 || $res > 1) {
- echo "FAILED\n";
-} else {
+if (is_null($res)) {
echo "PASSED\n";
+} else {
+ echo "FAILED\n";
}
echo "MATHS test script completed\n";
?>
---EXPECT--
+--EXPECTF--
MATHS test script started
lcg_value tests...
PASSED
- lcg_value error cases..spurious args get ignored
+ lcg_value error cases..
+
+Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d
PASSED
+
+Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d
PASSED
MATHS test script completed
-
-