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

AttachmentSize
domain_access_timezone_conf_fix.patch591 bytes

#1

agentrickard - October 23, 2009 - 16:02

Can we also use += here?

#2

agentrickard - October 23, 2009 - 16:07

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.

AttachmentSize
612808-tz.patch 1.04 KB

#3

voxpelli - October 23, 2009 - 16:19

Of course - a last minute mistake - your patch looks good

#4

agentrickard - October 23, 2009 - 16:31
Status:needs review» fixed

Excellent catch. I don't think this applies to the 5.x version, since the NULL element isn't in that.

Committed!

#5

System Message - November 6, 2009 - 16:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.