PHP upgrade to v5.2.10

Peter Oakley peteo at
Thu Jun 25 07:43:07 PDT 2009

Here is an example usage of the date() and time() functions:

snippetStart - - - - - -

$timestamp = time();
//echo $timestamp;
$thisYear = date('Y', $timestamp);
echo $thisYear;

- - - - - - snippetEnd

After the PHP upgrade to v5.2.10, this yields "0000" for $thisYear.  
Prior to the upgrade, $thisYear would be set to "2009". I also tried  
using the time function directly within the date function: $thisYear  
= date('Y', time()); Same result.

One other possibly important detail: I've installed a variant: php5  
+apache +macosx +mysql5 +t1lib

    - Pete O

On Jun 25, 2009, at 10:12 AM, Bradley Giesbrecht wrote:

> On Jun 25, 2009, at 7:09 AM, Peter Oakley wrote:
>> Last night I was upgrading my web server to PHP v5.2.10 (from  
>> v5.2.8) and everything seemed to go ok, no warnings or major  
>> gotchas. But once I began using it, I could see there were some  
>> real problems with the time() and date() functions. It's possible  
>> that I'm just using these two functions in ways that are either  
>> wrong (but have up to now served to accomplish the task I was  
>> seeking to do) or are no longer allowed, for security reasons, in  
>> which case I will need to develop a work-around. Or something is  
>> going wrong with the update. I'm writing to this list to see if  
>> anyone else has experienced this same problem, or if you all might  
>> have some ideas as to what's going on here.
> Give an example of your usage of time() and date(), what you expect  
> and what you are getting.
> // Brad

More information about the macports-users mailing list