Can't assign timezone default because of erroneous array_merge()
voxpelli - October 23, 2009 - 15:23
| Project: | Domain Access |
| Version: | 6.x-2.x-dev |
| Component: | - Domain Conf |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
This row in domain_conf.admin.inc destroys the numeric keys of the option array:
if ($action['#form']['#type'] == 'select') {
$action['#form']['#options'] = array_merge(array(NULL => t('Use primary domain settings')), $action['#form']['#options']);
}This makes assigning a different timezone impossible since the key in that option array is the numeric offset in seconds for the timezones.
I'm attaching a patch for this that replaces array_merge() with a plus.
Reference: http://se2.php.net/operators.array and http://goodold.se/blog/tech/danger-id-numbers-keys-php-arrays
| Attachment | Size |
|---|---|
| domain_access_timezone_conf_fix.patch | 591 bytes |

#1
Can we also use += here?
#2
Actually, we can't, since the point of array_merge() was to keep the NULL option at the top of the select list.
This should work.
#3
Of course - a last minute mistake - your patch looks good
#4
Excellent catch. I don't think this applies to the 5.x version, since the NULL element isn't in that.
Committed!
#5
Automatically closed -- issue fixed for 2 weeks with no activity.