Drupal 6.x install that is upgraded to D7. Running latest CCK 7.x-dev.
Unable to migrate simple integer number fields. Have multiple number fields but I not able to get them migrated. Other fields like text, date, email etc. all migrated OK.

field_number (number_integer)

PHP Fatal error: Unsupported operand types in /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/modules/field/field.crud.inc on line 601
PHP Stack trace:
PHP 1. {main}() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/index.php:0
PHP 2. menu_execute_active_handler() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/index.php:22
PHP 3. call_user_func_array() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/menu.inc:501
PHP 4. system_batch_page() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/menu.inc:0
PHP 5. _batch_page() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/modules/system/system.admin.inc:2282
PHP 6. _batch_do() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/batch.inc:81
PHP 7. _batch_process() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/batch.inc:162
PHP 8. call_user_func_array() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/batch.inc:285
PHP 9. _content_migrate_batch_process_create_fields() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/includes/batch.inc:0
PHP 10. field_create_instance() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/sites/all/modules/cck/modules/content_migrate/includes/content_migrate.admin.inc:229
PHP 11. _field_write_instance() /Users/steinmb/htdocs/sites/elmcip.net/drupal7_versjon/drupal/modules/field/field.crud.inc:491

Any ideas on where to start digging?

Comments

KarenS’s picture

I can confirm that the migration of number fields is broken, but haven't been able to figure out why. I found some things that needed to be altered differently in the drupal_alter but that didn't get me past the error.

KarenS’s picture

Title: Unable to migrate number_integer field type » Unable to migrate number fields

Actually it is not just integer fields, also having trouble with decimal and float fields. Everything *looks* right but something blows up when you try to migrate them.

solotandem’s picture

With the patch in #1157234: Various PHP fatal errors, typos, etc., I was able to migrate some number_integer fields. I haven't tried any other number fields. You might apply the patch and try other number fields.

KarenS’s picture

Status: Active » Fixed

Yes, seems to be working again.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

steinmb’s picture

Status: Closed (fixed) » Active

Hmmm reopening, I think we almost got it right. The integer fields now migrates, but I noticed when creating new nodes in D7, and leve those integer fields empty, causes Drupal 7 to blow up:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_number_value' at row 1: INSERT INTO {field_data_field_number} (entity_type, entity_id, revision_id, bundle, delta, language, field_number_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 1778 [:db_insert_placeholder_2] => 6857 [:db_insert_placeholder_3] => critical_writing [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 424 of modules/field/modules/field_sql_storage/field_sql_storage.module).

Workarounds:
- Populating the field enabled me to create the nodes.
- Editing the field (on all content types) changing a value and saving the field permanently fixed it.

Best regards
Stein

blasto333’s picture

subscribe, having the same problem as Stein described.

solotandem’s picture

@steinmb and @blasto333: Is the error from saving the node through the UI or programmatically? Is the error related to not having a default value on the integer field?

steinmb’s picture

#6. After the migration was done and I tried to create new nodes through the UI, left the number field empty and pressed save. Booom!

blasto333’s picture

@solotandem the error happens for integer's. I believe it is a default value issue because it tries to insert a '' into the database.

sahuni’s picture

Still problem whith migration of integer fields wich become List (integer) (without patch).
And when adding or updating a node with an integer fields :

Notice: Undefined variable: regexp in number_field_widget_validate() (line 389 of C:\Program Files\EasyPHP 3.0\www\CMS\muritMig2\modules\field\modules\number\number.module). 	
Warning: preg_replace() [function.preg-replace]: Empty regular expression in number_field_widget_validate() (line 389 of C:\Program Files\EasyPHP 3.0\www\CMS\muritMig2\modules\field\modules\number\number.module). 	
Notice: Undefined variable: message in number_field_widget_validate() (line 390 of C:\Program Files\EasyPHP 3.0\www\CMS\muritMig2\modules\field\modules\number\number.module). 

Can we have a new version of 7.2.dev with that point fixed?
This version is from August and I think after all that months, we could use migration of cck without patching?
1 year D7 is available, so migration will become more and more frequent.

steinmb’s picture

Do we even have a patch? Have not seen one, but if someone got some code laying around, post it here and we might get Karin to commit it when it is ready.

sahuni’s picture

well investigating more, I found that other integer fields migrated well.
This specific field is used by 2 content types, once with select list widget and the other time without widget. Perhaps problem comes from there. I don't know if its correct or not. For me, it's easy to change that because one of the content type has just 1 node, so I can delete and recreate the field. It's what I'll do before next migration test.

sahuni’s picture

I still have problem with integer fields I've migrated.
Fields are not required. When I create a new node, if I leave the field empty I have that pdo exception

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_altitude_bas_value' at row 1: INSERT INTO {field_data_field_altitude_bas} (entity_type, entity_id, revision_id, bundle, delta, language, field_altitude_bas_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 2904 [:db_insert_placeholder_2] => 2904 [:db_insert_placeholder_3] => bisse [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of C:\Program Files (x86)\EasyPHP-5.3.8.1\www\cms\mdbMig50\modules\field\modules\field_sql_storage\field_sql_storage.module).

sahuni’s picture

In fact, Drupal is trying to create a record in table field_data_field_xxx with value blank or something illegal.
Normally, for new field integer or noderef created in D7, when field stay empty or nothing is selected in select list, Drupal does not create a record.

Well I create a new issue, because this one have more tha 1 case inside: http://drupal.org/node/1431524

demon326’s picture

Sorry to bump this issue, but it seems i have the same problem, the only field and most important on won't get converted, it spits out the following error:
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /drupal7/batch?render=overlay&id=6094&op=do StatusText: OK ResponseText: ( ! ) Fatal error: Unsupported operand types in E:\wamp\www\drupal7\modules\field\field.crud.inc on line 602 Call Stack #TimeMemoryFunctionLocation 10.0002380960{main}( )..\index.php:0 20.187239794768menu_execute_active_handler( )..\index.php:21 30.190740765072call_user_func_array ( )..\menu.inc:516 40.190740765208system_batch_page( )..\menu.inc:516 50.190840765208_batch_page( )..\system.admin.inc:2353 60.190840765744_batch_do( )..\batch.inc:80 70.190840765744_batch_process( )..\batch.inc:161 80.192540995768call_user_func_array ( )..\batch.inc:284 90.192540995784_content_migrate_batch_process_create_fields( )..\batch.inc:284 100.998449719920field_create_instance( )..\content_migrate.admin.inc:257 111.000149727384_field_write_instance( )..\field.crud.inc:493

it's the only thing stopping the total upgrade....

steinmb’s picture

Have you tried to work around it? Read #6 and see if that helps.

demon326’s picture

The problem is that i won't go that far... because its not converted right, it won't show up in the node type's fields overview....

rfay’s picture

Priority: Critical » Major