From 3b874086e2e7e85c416d3d698bf1499cfe4eee82 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 12 Aug 2015 19:01:04 +0200 Subject: [PATCH] Fix #70245: strtotime does not emit warning when 2nd parameter is object or string Caused by a refactoring strtotime() called zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ...) instead of zend_parse_parameters(). --- ext/date/php_date.c | 2 +- ext/date/tests/bug70245.phpt | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 ext/date/tests/bug70245.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 52ce4b7ce8c..eeaed2b6603 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1461,7 +1461,7 @@ PHP_FUNCTION(strtotime) timelib_time *t, *now; timelib_tzinfo *tzi; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "s|l", ×, &time_len, &preset_ts) == FAILURE || !time_len) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", ×, &time_len, &preset_ts) == FAILURE || !time_len) { RETURN_FALSE; } diff --git a/ext/date/tests/bug70245.phpt b/ext/date/tests/bug70245.phpt new file mode 100644 index 00000000000..4bf62566006 --- /dev/null +++ b/ext/date/tests/bug70245.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #70245 (strtotime does not emit warning when 2nd parameter is object or string) +--FILE-- + +--EXPECTF-- +Warning: strtotime() expects parameter 2 to be integer, object given in %sbug70245.php on line %d +bool(false)