Index: tests/phpunit/tests/option/transient.php
===================================================================
--- tests/phpunit/tests/option/transient.php	(revision 30093)
+++ tests/phpunit/tests/option/transient.php	(working copy)
@@ -83,4 +83,13 @@
 		update_option( '_transient_timeout_' . $key, $now - 1 );
 		$this->assertFalse( get_transient( $key ) );
 	}
+
+	/**
+	 * ticket 15058
+	 */
+	function test_transient_long() {
+		$long_name = "thisisaverylongnamethatwillnotfitincolumnbecauseitistoolongforthecolumn";
+		set_transient( $long_name, true, 60 );
+		$this->assertTrue( get_transient( $long_name ) );
+	}
 }
Index: tests/phpunit/tests/option/option.php
===================================================================
--- tests/phpunit/tests/option/option.php	(revision 30093)
+++ tests/phpunit/tests/option/option.php	(working copy)
@@ -99,4 +99,17 @@
 	function test_special_option_name_notoptions() {
 		delete_option( 'notoptions' );
 	}
+
+	function test_option_add_long() {
+		$long_name = "thisisaverylongnamethatwillnotfitincolumnbecauseitistoolongforthecolumn";
+		add_option( $long_name, true );
+		$this->assertTrue( get_option( $long_name ) );
+	}
+
+	function test_option_update_long() {
+		$long_name = "thisisaverylongnamethatwillnotfitincolumnbecauseitistoolongforthecolumn";
+		add_option( $long_name, true );
+		update_option( $long_name, 5 );
+		$this->assertEquals( 5, get_option( $long_name ) );
+	}
 }
Index: src/wp-includes/option.php
===================================================================
--- src/wp-includes/option.php	(revision 30093)
+++ src/wp-includes/option.php	(working copy)
@@ -29,6 +29,8 @@
 	if ( empty( $option ) )
 		return false;
 
+	$option = long_option_name( $option );
+
 	/**
 	 * Filter the value of an existing option before it is retrieved.
 	 *
@@ -212,6 +214,24 @@
 }
 
 /**
+ * This function allows long option names to work.
+ *
+ * @since 4.1.0
+ * 
+ * @param string $option     Option name.
+ * @param int    $max_length Max length of the option name.
+ * @return string $option Modified option name if longer than $max_length.
+ */
+function long_option_name( $option, $max_length = 64 ) {
+	if( strlen( $option ) > 64 ) {
+		$option = md5( $option );
+		$option = "md5_" . $option;
+	} else {
+		return $option;
+	}
+}
+
+/**
  * Update the value of an option that was already added.
  *
  * You do not need to serialize values. If the value needs to be serialized, then
@@ -240,6 +260,8 @@
 	if ( is_object( $value ) )
 		$value = clone $value;
 
+	$option = long_option_name( $option );
+
 	$value = sanitize_option( $option, $value );
 	$old_value = get_option( $option );
 
@@ -377,6 +399,8 @@
 	$serialized_value = maybe_serialize( $value );
 	$autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
 
+	$option = long_option_name( $option );
+
 	/**
 	 * Fires before an option is added.
 	 *
@@ -582,6 +606,9 @@
 	if ( wp_using_ext_object_cache() ) {
 		$value = wp_cache_get( $transient, 'transient' );
 	} else {
+
+		$transient = long_option_name( $transient, 40 );
+
 		$transient_option = '_transient_' . $transient;
 		if ( ! defined( 'WP_INSTALLING' ) ) {
 			// If option is not in alloptions, it is not autoloaded and thus has a timeout
@@ -645,8 +672,12 @@
 	if ( wp_using_ext_object_cache() ) {
 		$result = wp_cache_set( $transient, $value, 'transient', $expiration );
 	} else {
+
+		$transient = long_option_name( $transient, 40 );
+
 		$transient_timeout = '_transient_timeout_' . $transient;
 		$transient = '_transient_' . $transient;
+
 		if ( false === get_option( $transient ) ) {
 			$autoload = 'yes';
 			if ( $expiration ) {
