View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012154 | mantisbt | time tracking | public | 2010-07-10 12:19 | 2011-08-05 02:57 |
| Reporter | vr5 | Assigned To | dhx | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Platform | x86 | OS | Fedora | OS Version | 12 |
| Product Version | 1.2.1 | ||||
| Target Version | 1.2.4 | ||||
| Summary | 0012154: Incorrect calls of strtotime | ||||
| Description | There are incorrect calls of strtotime in core/bugnote_api.php: $c_to = strtotime( $p_to, SECONDS_PER_DAY - 1 ); // @23:59:59 strtotime uses second argument only when first argument is a relative time (e.g. "one day ago", "next sunday", etc.) and ignores it otherwise. Thus results of a query to DB will not include records inserted during p_to day. | ||||
| Tags | patch | ||||
| Attached Files | calls-to-strtotime-fixed.patch (859 bytes)
--- core/bugnote_api.php.orig 2010-04-23 22:28:34.000000000 +0400
+++ core/bugnote_api.php 2010-07-10 19:37:07.000000000 +0400
@@ -589,7 +589,7 @@
*/
function bugnote_stats_get_events_array( $p_bug_id, $p_from, $p_to ) {
$c_bug_id = db_prepare_int( $p_bug_id );
- $c_to = strtotime( $p_to, SECONDS_PER_DAY - 1 ); // @23:59:59
+ $c_to = strtotime( $p_to ) + SECONDS_PER_DAY - 1; // @23:59:59
$c_from = strtotime( $p_from );
$t_user_table = db_get_table( 'mantis_user_table' );
@@ -637,7 +637,7 @@
function bugnote_stats_get_project_array( $p_project_id, $p_from, $p_to, $p_cost ) {
$c_project_id = db_prepare_int( $p_project_id );
- $c_to = strtotime( $p_to, SECONDS_PER_DAY - 1); // @23:59:59
+ $c_to = strtotime( $p_to ) + SECONDS_PER_DAY - 1; // @23:59:59
$c_from = strtotime( $p_from );
if ( $c_to === false || $c_from === false ) {
| ||||
|
I don't see any documentation on php.net (http://us.php.net/manual/en/function.strtotime.php) that confirms the behavior you describe. Can you provide a link to somewhere that agrees with your assessment? |
|
|
PHP manual seem to contain all needed information for this case, though it may be not really straightforward... Documentation for strtotime has following description of parameters: 1) "time According to http://us.php.net/manual/en/datetime.formats.php Mantis passes a value in format which described as "Date format" 2) "now Parameter "time" is not in "relative date" format, so it can be assumed that parameter "now" will not be used. A quick test confirms it: Well, maybe PHP documentation could be better... |
|
|
Thanks vr5, I can confirm what you're saying. I fixed another problem like this recently. I'll queue this up for fixing in 1.2.x. |
|