Fix a few typos and add a backport (compat) for hex2bin()
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 1c6e76b..3e1280b 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -249,7 +249,7 @@
 	require_once(BASEPATH.'core/compat/mbstring.php');
 	require_once(BASEPATH.'core/compat/hash.php');
 	require_once(BASEPATH.'core/compat/password.php');
-	require_once(BASEPATH.'core/compat/array.php');
+	require_once(BASEPATH.'core/compat/standard.php');
 
 /*
  * ------------------------------------------------------
diff --git a/system/core/compat/array.php b/system/core/compat/standard.php
similarity index 83%
rename from system/core/compat/array.php
rename to system/core/compat/standard.php
index 07dae21..6380fa1 100644
--- a/system/core/compat/array.php
+++ b/system/core/compat/standard.php
@@ -27,14 +27,13 @@
 defined('BASEPATH') OR exit('No direct script access allowed');
 
 /**
- * PHP ext/standard/array compatibility package
+ * PHP ext/standard compatibility package
  *
  * @package		CodeIgniter
  * @subpackage	CodeIgniter
  * @category	Compatibility
  * @author		Andrey Andreev
  * @link		http://codeigniter.com/user_guide/
- * @link		http://php.net/book.array
  */
 
 // ------------------------------------------------------------------------
@@ -125,6 +124,54 @@
 
 // ------------------------------------------------------------------------
 
+if (is_php('5.4'))
+{
+	return;
+}
+
+// ------------------------------------------------------------------------
+
+if ( ! function_exists('hex2bin'))
+{
+	/**
+	 * hex2bin()
+	 *
+	 * @link	http://php.net/hex2bin
+	 * @param	string	$data
+	 * @return	string
+	 */
+	function hex2bin($data)
+	{
+		if (in_array($type = gettype($data), array('array', 'double', 'object'), TRUE))
+		{
+			if ($type === 'object' && method_exists($data, '__toString'))
+			{
+				$data = (string) $data;
+			}
+			else
+			{
+				trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING);
+				return NULL;
+			}
+		}
+
+		if (strlen($data) % 2 !== 0)
+		{
+			trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING);
+			return FALSE;
+		}
+		elseif ( ! preg_match('/^[0-9a-f]*$/i', $data))
+		{
+			trigger_error('Input string must be hexadecimal string', E_USER_WARNING);
+			return FALSE;
+		}
+
+		return pack('H*', $data);
+	}
+}
+
+// ------------------------------------------------------------------------
+
 if (is_php('5.3'))
 {
 	return;
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index cc84abf..713c0fd 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -69,7 +69,7 @@
 include_once SYSTEM_PATH.'core/compat/mbstring.php';
 include_once SYSTEM_PATH.'core/compat/hash.php';
 include_once SYSTEM_PATH.'core/compat/password.php';
-include_once SYSTEM_PATH.'core/compat/array.php';
+include_once SYSTEM_PATH.'core/compat/standard.php';
 
 include_once $dir.'/mocks/autoloader.php';
 spl_autoload_register('autoload');
diff --git a/tests/codeigniter/core/compat/array_test.php b/tests/codeigniter/core/compat/standard_test.php
similarity index 91%
rename from tests/codeigniter/core/compat/array_test.php
rename to tests/codeigniter/core/compat/standard_test.php
index 9d2deab..8c7e731 100644
--- a/tests/codeigniter/core/compat/array_test.php
+++ b/tests/codeigniter/core/compat/standard_test.php
@@ -1,6 +1,6 @@
 <?php
 
-class array_test extends CI_TestCase {
+class standard_test extends CI_TestCase {
 
 	public function test_bootstrap()
 	{
@@ -8,13 +8,19 @@
 		{
 			return $this->markTestSkipped('All array functions are already available on PHP 5.5');
 		}
-		elseif ( ! is_php('5.3'))
+
+		$this->assertTrue(function_exists('array_column'));
+
+		if ( ! is_php('5.4'))
+		{
+			$this->assertTrue(function_exists('hex2bin'));
+		}
+
+		if ( ! is_php('5.3'))
 		{
 			$this->assertTrue(function_exists('array_replace'));
 			$this->assertTrue(function_exists('array_replace_recursive'));
 		}
-
-		$this->assertTrue(function_exists('array_column'));
 	}
 
 	// ------------------------------------------------------------------------
@@ -334,6 +340,25 @@
 	// ------------------------------------------------------------------------
 
 	/**
+	 * hex2bin() tests
+	 *
+	 * @depends	test_bootstrap
+	 */
+	public function test_hex2bin()
+	{
+		if (is_php('5.4'))
+		{
+			return $this->markTestSkipped('hex2bin() is already available on PHP 5.4');
+		}
+
+		$this->assertEquals("\x03\x04", hex2bin("0304"));
+		$this->assertEquals('', hex2bin(''));
+		$this->assertEquals("\x01\x02\x03", hex2bin(new FooHex()));
+	}
+
+	// ------------------------------------------------------------------------
+
+	/**
 	 * array_replace(), array_replace_recursive() tests
 	 *
 	 * Borrowed from PHP's own tests
@@ -410,8 +435,6 @@
 
 // ------------------------------------------------------------------------
 
-// These are necessary for the array_column() tests
-
 class Foo {
 
 	public function __toString()
@@ -426,4 +449,13 @@
 	{
 		return 'first_name';
 	}
+}
+
+class FooHex {
+
+	public function __toString()
+	{
+		return '010203';
+	}
+
 }
\ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 0895246..4bb2a3e 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -530,7 +530,7 @@
       - `Multibyte String <http://php.net/mbstring>`_ (limited support).
       - `Hash <http://php.net/hash>`_ (``hash_equals()``, ``hash_pbkdf2()``).
       - `Password Hashing <http://php.net/password>`_.
-      - `Array Functions <http://php.net/book.array>`_ (``array_column()``, ``array_replace()``, ``array_replace_recursive()``).
+      - `Standard Functions ``array_column()``, ``array_replace()``, ``array_replace_recursive()``, ``hexbin()``.
 
    -  Removed ``CI_CORE`` boolean constant from *CodeIgniter.php* (no longer Reactor and Core versions).
    -  Log Library will now try to create the **log_path** directory if it doesn't exist.
diff --git a/user_guide_src/source/general/compatibility_functions.rst b/user_guide_src/source/general/compatibility_functions.rst
index e685073..0dc8780 100644
--- a/user_guide_src/source/general/compatibility_functions.rst
+++ b/user_guide_src/source/general/compatibility_functions.rst
@@ -7,12 +7,12 @@
 but only in higher versions or depending on a certain extension.
 
 Being custom implementations, these functions will also have some
-set of dependancies on their own, but are still useful if your
+set of dependencies on their own, but are still useful if your
 PHP setup doesn't offer them natively.
 
 .. note:: Much like the `common functions <common_functions>`, the
 	compatibility functions are always available, as long as
-	their dependancies are met.
+	their dependencies are met.
 
 .. contents::
   :local:
@@ -29,7 +29,7 @@
 standard `Password Hashing extension <http://php.net/password>`_
 that is otherwise available only since PHP 5.5.
 
-Dependancies
+Dependencies
 ============
 
 - PHP 5.3.7
@@ -65,7 +65,7 @@
 	password_hash() <http://php.net/password_hash>`_.
 
 	.. note:: Unless you provide your own (and valid) salt, this function
-		has a further dependancy on an available CSPRNG source. Each
+		has a further dependency on an available CSPRNG source. Each
 		of the following would satisfy that:
 		- ``mcrypt_create_iv()`` with ``MCRYPT_DEV_URANDOM``
 		- ``openssl_random_pseudo_bytes()``
@@ -101,7 +101,7 @@
 and ``hash_pbkdf2()`` functions, which otherwise require PHP 5.6 and/or
 PHP 5.5 respectively.
 
-Dependancies
+Dependencies
 ============
 
 - None
@@ -144,19 +144,19 @@
 .. note:: When a character set parameter is ommited,
 	``$config['charset']`` will be used.
 
-Dependancies
+Dependencies
 ============
 
 - `iconv <http://php.net/iconv>`_ extension
 
-.. important:: This dependancy is optional and these functions will
+.. important:: This dependency is optional and these functions will
 	always be declared. If iconv is not available, they WILL
 	fall-back to their non-mbstring versions.
 
 .. important:: Where a character set is supplied, it must be
 	supported by iconv and in a format that it recognizes.
 
-.. note:: For you own dependancy check on the actual mbstring
+.. note:: For you own dependency check on the actual mbstring
 	extension, use the ``MB_ENABLED`` constant.
 
 Function reference
@@ -196,15 +196,14 @@
 	For more information, please refer to the `PHP manual for
 	mb_substr() <http://php.net/mb_substr>`_.
 
-***************
-Array Functions
-***************
+******************
+Standard Functions
+******************
 
 This set of compatibility functions offers support for a few
-standard `Array Functions <http://php.net/book.array>`_ in PHP
-that otherwise require a newer PHP version.
+standard functions in PHP that otherwise require a newer PHP version.
 
-Dependancies
+Dependencies
 ============
 
 - None
@@ -244,4 +243,13 @@
 	array_replace_recursive() <http://php.net/array_replace_recursive>`_.
 
 	.. important:: Only PHP's native function can detect endless recursion.
-		Unless you are running PHP 5.3+, be careful with references!
\ No newline at end of file
+		Unless you are running PHP 5.3+, be careful with references!
+
+.. function:: hex2bin($data)
+
+	:param	array	$data: Hexadecimal representation of data
+	:returns:	Binary representation of the given data
+	:rtype:	string
+
+	For more information, please refer to the `PHP manual for hex2bin()
+	<http://php.net/hex2bin>`_.
\ No newline at end of file
diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst
index 5d92b10..f29ebf4 100644
--- a/user_guide_src/source/libraries/encryption.rst
+++ b/user_guide_src/source/libraries/encryption.rst
@@ -5,13 +5,13 @@
 The Encryption Library provides two-way data encryption. To do so in
 a cryptographically secure way, it utilizes PHP extensions that are
 unfortunately not always available on all systems.
-You must meet one of the following dependancies in order to use this
+You must meet one of the following dependencies in order to use this
 library:
 
 - `OpenSSL <http://php.net/openssl>`_ (and PHP 5.3.3)
 - `MCrypt <http://php.net/mcrypt>`_ (and `MCRYPT_DEV_URANDOM` availability)
 
-If neither of the above dependancies is met, we simply cannot offer
+If neither of the above dependencies is met, we simply cannot offer
 you a good enough implementation to meet the high standards required
 for proper cryptography.