Merge pull request #3058 from vlakoff/word_wrap

Fixes in word_wrap() functions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 2f07234..dc5d17f 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -791,23 +791,27 @@
 			// Did the rule test negatively? If so, grab the error.
 			if ($result === FALSE)
 			{
-				// Check if a custom message is defined
-				if (isset($this->_field_data[$row['field']]['errors'][$rule]))
+				// Callable rules don't have named error messages
+				if ( ! is_callable($rule))
 				{
-					$line = $this->_field_data[$row['field']]['errors'][$rule];
-				}
-				elseif ( ! isset($this->_error_messages[$rule]))
-				{
-					if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule))
-						// DEPRECATED support for non-prefixed keys
-						&& FALSE === ($line = $this->CI->lang->line($rule, FALSE)))
+					// Check if a custom message is defined
+					if (isset($this->_field_data[$row['field']]['errors'][$rule]))
 					{
-						$line = 'Unable to access an error message corresponding to your field name.';
+						$line = $this->_field_data[$row['field']]['errors'][$rule];
 					}
-				}
-				else
-				{
-					$line = $this->_error_messages[$rule];
+					elseif ( ! isset($this->_error_messages[$rule]))
+					{
+						if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule))
+							// DEPRECATED support for non-prefixed keys
+							&& FALSE === ($line = $this->CI->lang->line($rule, FALSE)))
+						{
+							$line = 'Unable to access an error message corresponding to your field name.';
+						}
+					}
+					else
+					{
+						$line = $this->_error_messages[$rule];
+					}
 				}
 
 				// Is the parameter we are inserting into the error message the name