mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
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().
This commit is contained in:
parent
2366a070c8
commit
3b874086e2
@ -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;
|
||||
}
|
||||
|
||||
|
10
ext/date/tests/bug70245.phpt
Normal file
10
ext/date/tests/bug70245.phpt
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user