php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70245 strtotime does not emit warning when 2nd parameter is object or string.
Submitted: 2015-08-12 12:17 UTC Modified: 2015-08-12 17:05 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: arjen at react dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: 7.0.0beta3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arjen at react dot com
New email:
PHP Version: OS:

 

 [2015-08-12 12:17 UTC] arjen at react dot com
Description:
------------
http://3v4l.org/Zuv4a

Test script:
---------------
<?php

$d = new DateTime('2011-01-15 00:00:00');
$foo = strtotime('-1 month', $d);

Expected result:
----------------
Warning: strtotime() expects parameter 2 to be integer, object given in /in/Zuv4a on line 4

Actual result:
--------------
No warning.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-12 16:02 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2015-08-12 16:02 UTC] cmb@php.net
That appears to be an accidential side-effect of improving the
implementation of strtotime[1]. Calling zend_parse_parameters()
instead of zend_parse_parameters_ex() would restore the former
behavior.

[1] <https://github.com/php/php-src/commit/6a992e45831fda3e7f5df120660e3fd59a08028a>
 [2015-08-12 17:04 UTC] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3b874086e2e7e85c416d3d698bf1499cfe4eee82
Log: Fix #70245: strtotime does not emit warning when 2nd parameter is object or string
 [2015-08-12 17:04 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2015-08-12 17:05 UTC] cmb@php.net
The fix for this bug has been committed.

Thank you for the report, and for helping us make PHP better.
 [2015-08-18 16:24 UTC] ab@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3b874086e2e7e85c416d3d698bf1499cfe4eee82
Log: Fix #70245: strtotime does not emit warning when 2nd parameter is object or string
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3b874086e2e7e85c416d3d698bf1499cfe4eee82
Log: Fix #70245: strtotime does not emit warning when 2nd parameter is object or string
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC