← Back to team overview

mahara-contributors team mailing list archive

[Bug 1414628] A change has been merged

 

Reviewed:  https://reviews.mahara.org/4678
Committed: http://gitorious.org/mahara/mahara/commit/ec31ef4e699ad6cffa6fb3273b8e574fb9aaeead
Submitter: Aaron Wells (aaronw@xxxxxxxxxxxxxxx)
Branch:    1.9_STABLE

commit ec31ef4e699ad6cffa6fb3273b8e574fb9aaeead
Author: Brian King <brian.king@xxxxxxx>
Date:   Fri Feb 13 13:52:00 2015 +1300

Use different strptime params for BSD compatibility

Bug 1414628: The "tm_yday" (day of the year) param is not supplied by
strptime by default on BSD systems such as Mac OS X.
It works just as well to use "tm_mday" (day of the month) param instead,
and it also makes more sense!

Change-Id: I1484dcde4dbd8199f578a4eb5a58a9f78de45635

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1414628

Title:
  strptime on OS X always returns 0 for tm_wday and tm_yday

Status in Mahara ePortfolio:
  Fix Released
Status in Mahara 1.10 series:
  Fix Released
Status in Mahara 1.9 series:
  Fix Committed
Status in Mahara 15.04 series:
  Fix Released

Bug description:
  As mentioned in this 5-year old comment on the php documentation page
  http://php.net/manual/en/function.strptime.php#89239 , tm_wday and
  tm_yday are not initialized on BSD-based systems.

  This is apparently still true, at least on OS X.  I'm running PHP
  5.5.20, and these values are always set to 0.

  htdocs/view/access.php in Mahara 1.10.2 uses tm_wday in the
  ptimetotime() function.

  I propose that this method be updated to not use tm_wday, since it
  doesn't need to.

  ```
  diff --git a/htdocs/view/access.php b/htdocs/view/access.php
  index 26ea7d3..299bf89 100644
  --- a/htdocs/view/access.php
  +++ b/htdocs/view/access.php
  @@ -336,8 +336,8 @@ function ptimetotime($ptime) {
           $ptime['tm_hour'],
           $ptime['tm_min'],
           $ptime['tm_sec'],
  -        1,
  -        $ptime['tm_yday'] + 1,
  +        $ptime['tm_mon'] + 1,
  +        $ptime['tm_mday'],
           $ptime['tm_year'] + 1900
       );
   }
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1414628/+subscriptions


References