com php-src: Fix #70245: strtotime does not emit warning when 2nd parameter is object or string: ext/date/php_date.c ext/date/tests/b ug70245.phpt

From: Date: Wed, 12 Aug 2015 17:01:04 +0000
Subject: com php-src: Fix #70245: strtotime does not emit warning when 2nd parameter is object or string: ext/date/php_date.c ext/date/tests/b ug70245.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88496@lists.php.net to get a copy of this message
Commit: 3b874086e2e7e85c416d3d698bf1499cfe4eee82 Author: Christoph M. Becker <cmb@php.net> Wed, 12 Aug 2015 19:01:04 +0200 Parents: 2366a070c819f96d47f28021e76e0f01a7e1f7f4 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3b874086e2e7e85c416d3d698bf1499cfe4eee82 Log: 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(). Bugs: https://bugs.php.net/70245 Changed paths: M ext/date/php_date.c A ext/date/tests/bug70245.phpt Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 52ce4b7..eeaed2b 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", &times, &time_len, &preset_ts) == FAILURE || !time_len) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &times, &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 0000000..4bf6256 --- /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-- +<?php +$d = new DateTime('2011-01-15 00:00:00'); +var_dump(strtotime('-1 month', $d)); +?> +--EXPECTF-- +Warning: strtotime() expects parameter 2 to be integer, object given in %sbug70245.php on line %d +bool(false)

« previous php.cvs (#88496) next »