← Back to team overview

mahara-contributors team mailing list archive

[Bug 1414628] [NEW] strptime on OS X always returns 0 for tm_wday and tm_yday

 

Public bug reported:

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
     );
 }
```

** Affects: mahara
     Importance: Undecided
         Status: New


** Tags: osx

-- 
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:
  New

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


Follow ups

References