? serialize.patch ? serialize2.patch ? sites/default/files ? sites/default/private ? sites/default/settings.php Index: modules/field/modules/text/text.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v retrieving revision 1.22 diff -u -p -r1.22 text.test --- modules/field/modules/text/text.test 10 Apr 2010 10:01:15 -0000 1.22 +++ modules/field/modules/text/text.test 23 Apr 2010 17:09:44 -0000 @@ -71,8 +71,15 @@ class TextFieldTestCase extends DrupalWe * Test widgets. */ function testTextfieldWidgets() { + $this->pass("Starting testTextfieldWidgets"); $this->_testTextfieldWidgets('text', 'text_textfield'); + $this->pass("Finished testTextfieldWidgets"); + } + + function testTextfieldWidgetsLong() { + $this->pass("Starting testTextfieldWidgetsLong"); $this->_testTextfieldWidgets('text_long', 'text_textarea'); + $this->pass("Finished testTextfieldWidgetsLong"); } /** Index: modules/simpletest/tests/database_test.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v retrieving revision 1.87 diff -u -p -r1.87 database_test.test --- modules/simpletest/tests/database_test.test 11 Apr 2010 18:33:44 -0000 1.87 +++ modules/simpletest/tests/database_test.test 23 Apr 2010 17:09:45 -0000 @@ -629,6 +629,27 @@ class DatabaseInsertLOBTestCase extends $r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc(); $this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', t('Can insert multiple blobs per row.')); } + + /** + * Test that we can insert serialized data into important fields. + */ + function testInsertSerializedData() { + // Alternative crash cases: + // 1) + // drupal_set_message("Please dont crash" . hash('md5', 'too late', TRUE)); + // drupal_exit(); + // 2) + // variable_set("dontcrash", "Please dont crash" . hash('md5', 'too late', TRUE)); + $name = "dontcrash"; + $value = "Please dont crash" . hash('md5', 'too late', TRUE); + try { + db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); + $this->pass(t('Success! No PDO exception thrown.')); + } catch (Exception $e) { + $this->fail(t('Fail! Your serialized blobs are quite distraught.')); + } + + } } /** Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.461 diff -u -p -r1.461 system.install --- modules/system/system.install 10 Apr 2010 17:30:15 -0000 1.461 +++ modules/system/system.install 23 Apr 2010 17:09:47 -0000 @@ -437,7 +437,7 @@ function system_schema() { ), 'value' => array( 'description' => 'The value of the variable.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', 'translatable' => TRUE, @@ -472,7 +472,7 @@ function system_schema() { ), 'parameters' => array( 'description' => 'Parameters to be passed to the callback function.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', ), @@ -511,7 +511,7 @@ function system_schema() { ), 'batch' => array( 'description' => 'A serialized array containing the processing data for the batch.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', ), @@ -845,12 +845,12 @@ function system_schema() { ), 'load_functions' => array( 'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, ), 'to_arg_functions' => array( 'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, ), 'access_callback' => array( @@ -862,8 +862,9 @@ function system_schema() { ), 'access_arguments' => array( 'description' => 'A serialized array of arguments for the access callback.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, + 'size' => 'big', ), 'page_callback' => array( 'description' => 'The name of the function that renders the page.', @@ -874,8 +875,9 @@ function system_schema() { ), 'page_arguments' => array( 'description' => 'A serialized array of arguments for the page callback.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, + 'size' => 'big', ), 'delivery_callback' => array( 'description' => 'The name of the function that sends the result of the page_callback function to the browser.', @@ -1044,8 +1046,9 @@ function system_schema() { ), 'options' => array( 'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, + 'size' => 'big', 'translatable' => TRUE, ), 'module' => array( @@ -1200,7 +1203,7 @@ function system_schema() { 'description' => 'The queue name.', ), 'data' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, @@ -1379,7 +1382,7 @@ function system_schema() { ), 'session' => array( 'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', ), @@ -1455,8 +1458,9 @@ function system_schema() { ), 'info' => array( 'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, dependents, and php.", - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, + 'size' => 'big', ), ), 'primary key' => array('filename'), @@ -2398,6 +2402,31 @@ function system_update_7052() { } /** + * Convert serialized fields to blob. + */ +function system_update_7053() { + // PDO throws exception on binary data serialized into 'text' fields. Convert to 'blob'. See http://drupal.org/node/690746 + // These fields remain text: cache.headers, menu_router.description, menu_router.include_file + // See database_test.test: DatabaseTestCase + $small = array('type' => 'blob', 'size' => 'small'); + $big = array('type' => 'blob', 'size' => 'big'); + + db_change_field('variable', 'value', 'value', $big); + db_change_field('sessions', 'session', 'session', $big); + db_change_field('actions', 'parameters', 'parameters', $big); + db_change_field('batch', 'description', 'description', $big); + db_change_field('menu_router', 'load_functions', 'load_functions', $small); + db_change_field('menu_router', 'to_arg_functions', 'to_arg_functions', $small); + db_change_field('menu_router', 'access_arguments', 'access_arguments', $big); + db_change_field('menu_router', 'page_arguments', 'page_arguments', $big); + db_change_field('menu_links', 'options', 'options', $big); + db_change_field('queue', 'data', 'data', $big); + db_change_field('system', 'info', 'info', $big); + + return t("Serialized fields converted to blobs."); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */