Running the xmlrpc tests, I get 29 of the mostly-same exceptions:
date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead Run-time notice xmlrpc.inc 384-390 xmlrpc_date() - 28 exceptions
mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead Run-time notice xmlrpc_test.module 33 xmlrpc_test_manyTypesTest() - 1 exception
From the PHP manual (http://us2.php.net/date):
Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT message if using the system settings or the TZ environment variable. See also date_default_timezone_set()
I know Drupal has it's own way of handling timezones, but is there a way to pass that info to date_default_timezone_set() so we don't get these test exceptions? Should we be using Drupal's existing format_date?
Using PHP 5.2.4-2ubuntu5.3. The following is the 'date' section of my phpinfo():
date/time support enabled
"Olson" Timezone Database Version 2007.6
Timezone Database internal
Default timezone America/Chicago
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | xmlrpc-test-timezone-D7.patch | 2.07 KB | dave reid |
| #2 | xmlrpc-test-timezone-D7.patch | 1.26 KB | dave reid |
Comments
Comment #1
dave reidComment #2
dave reidPatch changes the date() calls to durpal_format_date() and fixes 28 of 29 exceptions. Trying to figure out how to fix the mktime call...
Comment #3
damien tournoud commented@Dave: you should simply use gmmktime
Comment #4
damien tournoud commented... and gmdate()... if you really want to use format_date, please also add a sane $langcode parameter.
Comment #5
dave reidThanks Damien for pointing me in the better direction. Attached patch now passes 100% for xmlrpc with no exceptions. I like seeing green. Needs a little review.
Comment #6
damien tournoud commentedI can confirm I also get these exceptions when running in
E_ALL | E_STRICTmode. The patch remove those exceptions, it's logic is sound. Thanks, Dave.Comment #7
damien tournoud commentedOh, and this is a true bug in the XML-RPC implementation, that should be backported all the way down to D5.
Comment #8
dries commentedI've committed this patch to CVS HEAD, and backported the xmlrpc.inc part to DRUPAL-6. All committed. Thanks!
Comment #9
damien tournoud commentedTo be ported to D5.
Comment #10
marcingy commentedMarking as won't fix as d5 is end of life.