When using client internal name prefixes, odd behaviour can result. As far as I can see, it appears linked to having the same first letter for the client name and the prefix.

I first noticed this with a client named 'cbpq' and a prefix of 'cl-', where the internal name started out 'cl-cbpq', it's now stuck at 'cl-bpq'.

To replicate, add a client internal name prefix (admin/hosting/client) of 'ab-', then try creating a client named 'aaaa'. The resulting client internal name will be 'ab-'!

I'm guessing there's a malformed regex somewhere in hosting_client.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ergonlogic’s picture

The problem would appear to be in hosting_client_sanitize():

// we remove the prefix in case we are validating an existing uname
  $title = ltrim($title, $prefix);

ltrim appears to take a list of characters to strip as it's second parameter, rather than a string of characters.

ergonlogic’s picture

fixed in the attached patch

ergonlogic’s picture

Assigned: Unassigned » ergonlogic
Status: Active » Needs review
Steven Jones’s picture

This was done by anarcat in 7.x-2.x here:
http://drupalcode.org/project/hostmaster.git/commitdiff/ae587a6b1198fab2...

So I'm not sure why he didn't merge that back into 6.x? Would that have any adverse side effects?

ergonlogic’s picture

I suspect this was just an oversight. It looks like it does the same thing as my patch (just more elegantly).

I'll test in 6.x and report back.

ergonlogic’s picture

Status: Needs review » Reviewed & tested by the community
Steven Jones’s picture

Status: Reviewed & tested by the community » Fixed

Pushed into git.

Status: Fixed » Closed (fixed)

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