Skip to content

Commit

Permalink
MDL-42071 caching Validate setservers correctly for php pre 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmerrill committed Jul 2, 2014
1 parent cd230b3 commit 9043a10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cache/stores/memcache/addinstanceform.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ public function validation($data, $files) {

if (isset($data['clustered']) && ($data['clustered'] == 1)) {
// Set servers is required with in cluster mode.
if (!isset($data['setservers']) || empty(trim($data['setservers']))) {
if (!isset($data['setservers'])) {
$errors['setservers'] = get_string('required');
} else {
$trimmed = trim($data['setservers']);
if (empty($trimmed)) {
$errors['setservers'] = get_string('required');
}
}

$validservers = false;
Expand Down
7 changes: 6 additions & 1 deletion cache/stores/memcached/addinstanceform.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ public function validation($data, $files) {

if (isset($data['clustered']) && ($data['clustered'] == 1)) {
// Set servers is required with in cluster mode.
if (!isset($data['setservers']) || empty(trim($data['setservers']))) {
if (!isset($data['setservers'])) {
$errors['setservers'] = get_string('required');
} else {
$trimmed = trim($data['setservers']);
if (empty($trimmed)) {
$errors['setservers'] = get_string('required');
}
}

$validservers = false;
Expand Down

0 comments on commit 9043a10

Please sign in to comment.