Skip to content
Snippets Groups Projects
Commit 41f463d9 authored by Yas Naoi's avatar Yas Naoi
Browse files

Fixing a bug for trim()

parent 9c021216
No related branches found
No related tags found
No related merge requests found
...@@ -330,12 +330,14 @@ function aws_cloud_add_form_validate($form, &$form_state) { ...@@ -330,12 +330,14 @@ function aws_cloud_add_form_validate($form, &$form_state) {
if ($form_state['values']['op'] == 'Create') { if ($form_state['values']['op'] == 'Create') {
$cloud_name = trim($form_state['values']['cloud_name']); $cloud_name = isset($form_state['values']['cloud_name'])
? trim($form_state['values']['cloud_name'])
: '';
if (!preg_match('!^[a-z0-9_]+$!', $cloud_name)) { if (!preg_match('!^[a-z0-9_]+$!', $cloud_name)) {
form_set_error('cloud_name', t('The Cloud Name must contain only lowercase letters, numbers, and underscores.')); form_set_error('cloud_name', t('The Cloud Name must contain only lowercase letters, numbers, and underscores.'));
} }
$db_check = trim(cloud_check_cloud_name($cloud_name)); $db_check = cloud_check_cloud_name($cloud_name);
if (count($db_check)) { if (count($db_check)) {
form_set_error('cloud_name', t('The Cloud Name chosen is not unique')); form_set_error('cloud_name', t('The Cloud Name chosen is not unique'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment