Next Steps:

--
My client is populating nodes with data, and every now and then they get this error:

Notice: Trying to get property of non-object in file_field_presave() (line 221 of /httpdocs/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 575 of /httpdocs/includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1305820825 ) in drupal_write_record() (line 6776 of /httpdocs/includes/common.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1305820825 ) in drupal_write_record() (line 6776 of /httpdocs/includes/common.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1305820825 ) in drupal_write_record() (line 6776 of /httpdocs/includes/common.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1305820825 ) in drupal_write_record() (line 6776 of /httpdocs/includes/common.inc).

I've only found reference to the same PDOException and initial notice here:

http://drupal.org/node/924228#comment-4422726

Effectively, it looks like Drupal is trying to save a file, but there's no filename or filesave, so it's failing as a duplicate of the first time this happened (and was stored in the DB).
I think the PDOException is just a symptom, and the real problem is that an invalid file object is being passed along.

I can't be sure whether my client is trying to upload/delete/change a file, or just entering text data into other fields, but this comes up frequently and seemingly at random.

The easiest way to reproduce this error is:

  1. Add an image field into a node
  2. Create a new node and upload an image to its node
  3. Delete the image from the file system (Not through the Drupal UI)
  4. Try to upload the same image into another node
Files: 
CommentFileSizeAuthor
#167 error database.png70.29 KBjomarocas
#157 error1.png24.9 KBshakthik92
#141 file-Integrity_constraint_violation-1163740-141.patch2.89 KBrevagomes
FAILED: [[SimpleTest]]: [MySQL] 59,627 pass(es), 41 fail(s), and 0 exception(s).
[ View ]
#137 file-Integrity_constraint_violation-1163740-137.patch909 bytesrevagomes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,960 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#134 file-Integrity_constraint_violation-1163740-134.patch918 bytesrevagomes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-Integrity_constraint_violation-1163740-134.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#108 file-integrity-violation-fix-both-1163740-108.patch1.38 KBj0rd
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-integrity-violation-fix-both-1163740-108.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#107 file-integrity-violation-fix-both-1163740-107.patch1004 bytesj0rd
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-integrity-violation-fix-both-1163740-107.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#66 file.field_.inc-1163740.patch508 byteskenorb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc-1163740_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#62 file.field_.inc-1163740.patch534 byteskenorb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc-1163740.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#59 file.field_.inc_.patch520 byteskenorb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc_.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#56 aat-drupal-clean_myaat_services_workexperience_submit_preview--1339162858.xt_.txt.gz97.43 KBkenorb

Comments

Jeffm’s picture

Same issue here

valderama’s picture

i having this problem too, when a new user account is created. I have an image field at the user entity.

Any ideas?

lyricnz’s picture

Status:Active» Postponed (maintainer needs more info)

Looks like file_load($fid) is failing, and not being checked before being saved. Can you add some debugging to file_field_presave() for this situation? Unless I can reproduce, I can't fix it.

blischalk’s picture

I am also having this issue when trying to import nodes from a D5 install to D7 in a batch operation. When node_save is getting called on nodes that have file fields attached to them I receive this error. I have added a little debugging to file_field_presave as was mentioned in the previous thread and what I discovered is that it appears that file_load is failing. I dump the results of $item in the forach loop I get Array ( [fid] => 7412 [display] => 0 ) so a fid is being passed to file_load. Then if I dump the results of file it seems to have nothing in it... I will look into the file_load function a little deeper but I thought this information may be helpful.

blischalk’s picture

Some further research revealed some errors in my watchdog logs:
Notice: Trying to get property of non-object in file_field_presave() (line 220 of /src/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 573 of /src/includes/file.inc).
Followed by the duplicate entry error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1312214252 ) in drupal_write_record() (line 6861 of /src/includes/common.inc).

xamount’s picture

subscribe

I'm also getting this error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://field/image/icon-idea_0_2.gif' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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] => 13 [:db_insert_placeholder_1] => icon-idea_0.gif [:db_insert_placeholder_2] => public://field/image/icon-idea_0_2.gif [:db_insert_placeholder_3] => image/gif [:db_insert_placeholder_4] => 2329 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1318004968 ) in drupal_write_record() (line 6776 of /var/www/html/mysite/includes/common.inc).

I have double checked that full/read write access to the files directory and its good but still I can't figure it out..

pbeakley’s picture

Subscribing -- getting the same thing here. My first D7 installation.

mvissers’s picture

Subscribe

bradhawkins’s picture

subscribe

poorva’s picture

Version:7.x-dev» 7.7

Me also having this error in log entries when node edit.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'iydT2U2LvDVLXM0qUWFb8l8uPMY0HvIkMIxaNv9X63A' for key 2: INSERT INTO {redirect} (hash, type, uid, source, source_options, redirect, redirect_options, language, status_code, count, access) 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, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => iydT2U2LvDVLXM0qUWFb8l8uPMY0HvIkMIxaNv9X63A [:db_insert_placeholder_1] => redirect [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => content/extension [:db_insert_placeholder_4] => a:0:{} [:db_insert_placeholder_5] => node/27 [:db_insert_placeholder_6] => a:0:{} [:db_insert_placeholder_7] => und [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 ) in drupal_write_record()

greggles’s picture

Category:bug» support
Status:Postponed (maintainer needs more info)» Fixed

I believe this is caused by permission issues on the directories.

Be sure whatever user is running the script has the right permissions on the files directory and all subdirectories. If you are running something as drush then it runs as the command line user so that user needs to have read/write on the files directory (possibly via unix groups management).

poorva’s picture

But I was working with super admin, I think there should be no permission issue.

greggles’s picture

@poorva - I mean file system permissions issue. Like the unix users and groups and rwxrwxrwx kind of stuff.

taecelle’s picture

Subscribe
Also have this problem and all permissions are ok((

shythai’s picture

Version:7.7» 7.2

Subscribe
I use drupal 7.2. This message happens when I try to update title of any content. Normally it works fine, but just suddenly the error appears as below:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'DlJJ22fbfO-l-aM3d6mFmdFE8TKU52M7rikVGuxctS8' for key 2: INSERT INTO {redirect} (hash, type, uid, source, source_options, redirect, redirect_options, language, status_code, count, access) 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, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => DlJJ22fbfO-l-aM3d6mFmdFE8TKU52M7rikVGuxctS8 [:db_insert_placeholder_1] => redirect [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => news/test [:db_insert_placeholder_4] => a:0:{} [:db_insert_placeholder_5] => node/227 [:db_insert_placeholder_6] => a:0:{} [:db_insert_placeholder_7] => und [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 ) in drupal_write_record() (line 6851 of ...

shythai’s picture

Version:7.2» 7.7
shythai’s picture

See this post http://drupal.org/node/1185368

I tried print_r($fields) as Mamouri mentioned and I found that Module "redirect" cause this error for my case.

Thanks to Mamouri

Status:Fixed» Closed (fixed)

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

bensoi’s picture

subscribed. any solution for this? i encountered the same error in D 7.9.

Bartox’s picture

Subscribing. Getting this same issue on D7.10 core. Additional I can confirm it's happening when I've all cache combo enabled (Varnish server, Boost, APC & Memcache), but definitely getting this because of the Memcache. It happens often right after Remove an image and then placed a new one. A popup with the message:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /fr/file/ajax/field_image/und/0/form--72WREWH7Nx68im6zAdWBPMgRtTFjHkN8D-5K0w9azo
StatusText: n/a
ResponseText:
Error
Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://_mg_2699_0.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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] => 1
[:db_insert_placeholder_1] => _mg_2699.jpg
[:db_insert_placeholder_2] => public://_mg_2699_0.jpg
[:db_insert_placeholder_3] => image/jpeg
[:db_insert_placeholder_4] => 87206
[:db_insert_placeholder_5] => 0
[:db_insert_placeholder_6] => 1324339254
)
in drupal_write_record() (line 6888 of /var/www/ZZZZ/staging/releases/20111219211239/includes/common.inc).
The website encountered an unexpected error. Please try again later.

Let me know if you have any ideas how to solve this out. Thanks

loopy1492’s picture

I believe this happened to a View after we had a PHP timeout.

Now the View is stuck in the system and I can't delete it nor can I edit it. It's just stuck there.

When I try to edit:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'what_s_new' for key 2: INSERT INTO {views_view} (name, description, tag, base_table, human_name, core) 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); Array ( [:db_insert_placeholder_0] => what_s_new [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => default [:db_insert_placeholder_3] => node [:db_insert_placeholder_4] => What's New [:db_insert_placeholder_5] => 7 ) in views_db_object->save_row() (line 2043 of /mnt/stor9-wc1-dfw1/645415/www.ZZZZZZZZZZZZ.com/web/content/zzzzzzzzzzz/sites/all/modules/views/inc...)

When I try to delete:
Notice: Undefined property: view::$export_type in ctools_export_ui->access() (line 128 of /mnt/stor9-wc1-dfw1/645415/www.ZZZZZZZZZZZ.com/web/content/zzzzzzzzzzz/sites/all/modules/ctools/plu...).
You are not authorized to access this page.

Could the answer to this problem be to increase your timeout length?

loopy1492’s picture

I think I know the chain of events here.

User tries to do something in Drupal.
Drupal times out.
User presses back button.
User submits the same form again.
Error and corrupted data are the result.

Possible Solution:

Open .htaccess file and add this line to stop the timeouts:
php_value memory_limit 64M

Now, to delete the corrupted records, go into your database and find the corrupted item, then delete it. In my case, it was in the "views_view" table. It's easy to find since the name of the view is stored in that table.

If someone knows of another table where stuff needs to be deleted, please let us know.

toniodrupal’s picture

Version:7.7» 7.8

I got a similar notification/error using drupal 7.8 on windows 7 with an xampp 1.7.7 localhost.

I discovered a way to reproduce it (my notification) and to remove it.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://hoofdstukken/hoofdstuk3_0.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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] => 1 [:db_insert_placeholder_1] => hoofdstuk3.jpg [:db_insert_placeholder_2] => public://hoofdstukken/hoofdstuk3_0.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 5363 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1325441672 ) in drupal_write_record() (regel 6868 vanG:\xampp\htdocs\adida.nl23dec\includes\common.inc).

The closest I come to the reported comments, is that I removed image-files from a folder drupal puts the attached files/images in (as I later discovered). I wanted to remove these image-files in order to clean up the folder from a couple of copies (image_0.jpg, image_1.jpg, ...) I did not (knowingly) put there myself.
Finally I could reproduce the notification and made it go away. Perhaps someone can use this information to prevent this notification from happening in the first place.

----------------------------
I used the attach_file module (filefield_sources-7.x-1.4.zip) to attach a different jpg-image (<9K) to a series of nodes through an image-field. This image-field was part of a bookpage content type form with a bunch of other fields. The image appears via a cck-block in the second side-bar on a webpage above the book navigation. I cannot give a weblink, because I am still developing the site on my localhost.
Within the book type form the images are uploaded from the folder “sites/default/files/attach_files_[name]”. I used the name “hoofdstukken” (=Dutch for chapters) and assigned the name "attach_files_hoofdstukken" to the folder where I put the images. These assignments were done in the file attach section of the form that controls the image-field. In the same form I assigned the folder "sites/default/files/hoofdstukken" to the folder where drupal should place the attached image-files.

As for the reported notification/error it took me a while before I figured out how to reproduce it and what to do about it. The information in the above comments helped. I used phpmyadmin to check the database entries.

------------------------------
I observed that when attaching an image-file in the book content form to the image field, data is stored in the database in “prefix_field_data_[name of field]”. For example: with "prefix=drup_" and “name of the field=field_image_deel_een", the database has an entry “drup_field_data_field_image_deel_een”. In this database entry the column “entity_id” has the number of the node that is attached to this specific "field_image_deel_een". The column “field_image_deel_een_fid” has the “file id number” [the file being an image file] which is reported/managed in the database entry “drup_file_managed”. The entry “drup_file_managed” not only has the file ID (fid) but also the specific “filename” and the uri. The database also has a revision entry “prefix_field_revison_[name of field]”: in this specific case “drup_field_revison_field_image_deel_een”

------------------------------
Putting the above information in a scheme gives three entries/rows in the database where information about the node and the attached image is stored.

  1. prefix_field_data_[name of field]: contains “entity_id”=node ID; “[name of field]_fid” has the “file id number” where in my case the file is an image
  2. prefix_file_managed: contains fid; specific name of the file/image; uri of the file/image
  3. prefix_field_revision_[name of field]: contains “entity_id”=node ID; fid; revision_id

------------------------------------------
When for example the attached image.jpg is deleted from a node, I expected that all the information about the connection between image.jpg and the node is removed. But it isn’t.

First of all image.jpg is not removed from the folder where drupal stored image.jpg when it was attached. De-attaching image.jpg from the node is recorded in 1 (the node ID is removed), but not in 2 and 3 (the fid and the image remain).
So when re-attaching the same image.jpg to the node by selecting it from the attach_file folder, drupal generates a copy (image_0.jpg) in de folder where the attached images/files are placed (in my case sites/default/files/hoofdstukken). In the admin node-form through which this image.jpg is re-attached the original name shows up: image.jpg (which makes sense).
When deleting the re-attached image before saving the node-form, drupal removes the copy (image_0.jpg) from the folder. However when deleting the re-attached image.jpg through/in the node form, after having saved the node-form, neither of the images (image.jpg or image_0.jpg) disappear from the folder.
And when re-attaching the same image.jpg to the node (after having it removed) by selecting it via attach, drupal puts another copy (image_1.jpg) in the folder. Again only the name of the name of the re-attached image is reported in the node-form (which makes sense). So the deleted actions were not registered in the database under entry 2 and 3 (see above list). And after having attached, removed an re-attached the same image (with saving in between), the folder where drupal stores the attached images/files contains a series of copies of the same image: image.jpg, image_0.jpg, image_1.jpg, image_2.jpg ....
-----------------------
The showing up of the notification
When deleting one of the copies from the folder where drupal stores the attached images (to clean up the folder) and when re-attaching image.jpg to the node, drupal completes the original series and makes a new copy.
However when deleting all of the images and image-copies from the folder and then trying to re-attach the same image.jpg in the node-form, the attachment does not complete itself: on the form page the “please wait” image/spinning circle sign remains spinning. At first I thought of a time out problem. When saving the node-form, the reported PDOException notification shows up: apparently drupal is missing the older copies (place holders?) and therefore cannot make the necessary copy (image_x.jpg) to be re-attached to the node.

Removing/preventing the notification
This PDOException notification does not show up again, and image.jpg can be re-attached to the node, when all the info in database entries 2 and 3 (see above list) about the specific image is deleted. I used phpmyadmin to do that. Be sure to make a backup before changing the database in case you need to go back!

In addition: when using an default image for an image-field, drupal stores a copy of the attached/uploaded image in sites/defaults/files/default_images. Removing or cleaning up a default image is done by removing the corresponding row in entry 2 together with the image and its copies from the default_images folder. Drupal itself generates this default_images folder.

I am not much of a programmer to figure out a script to have drupal remove all the information when removing a previous attached image or a file through a field to a node. I suppose it can be done. Manually cleaning up a site as indicated when developing it is not so hard.

Cybertrail’s picture

Version:7.8» 7.10

I had a similar problem when upgrading from 7.9 to 7.10:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'FileTransfer-class' for key 1: INSERT INTO {registry} (name, type, filename, module, weight)
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, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9)
, (:db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14)
, (:db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19)
; Array ( [:db_insert_placeholder_0] => FileTransfer [:db_insert_placeholder_1] => class [:db_insert_placeholder_2] => includes/filetransfer/filetransfer/filetransfer.inc [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => FileTransferException [:db_insert_placeholder_6] => class [:db_insert_placeholder_7] => includes/filetransfer/filetransfer/filetransfer.inc [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => FileTransferChmodInterface [:db_insert_placeholder_11] => interface [:db_insert_placeholder_12] => includes/filetransfer/filetransfer/filetransfer.inc [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => 0 [:db_insert_placeholder_15] => SkipDotsRecursiveDirectoryIterator [:db_insert_placeholder_16] => class [:db_insert_placeholder_17] => includes/filetransfer/filetransfer/filetransfer.inc [:db_insert_placeholder_18] => [:db_insert_placeholder_19] => 0 )
in _registry_parse_file()
(line 179 of /var/www/vhosts/website_name.ca/httpdocs/includes/registry.inc)

I don't normally use Parallels Plesk Panel which has a curious habit of duplicating folders during a file/folder move. For example it created an /includes/includes folder with new content leaving the original content in /includes. I removed the duplicate files and folders and it solved the problem.

phoang’s picture

Category:support» bug
Priority:Normal» Critical
Status:Closed (fixed)» Active

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://images/product/gmc_bose_menu_0.jpg' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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] => 91 [:db_insert_placeholder_1] => gmc_bose_menu.jpg [:db_insert_placeholder_2] => public://images/product/gmc_bose_menu_0.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 396130 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1327532292 ) in drupal_write_record() (line 6888 of /home/ottonavi/public_html/includes/common.inc).

marcoka’s picture

fyi this can also be happen if your php tomeout/script runtime is too low. i had around 60 but did a huge batch job creating nodes and some had a lot more data (images) to it. these big nodes where what cause the error here.
so the solution was raising timeouts for the import.

catch’s picture

Version:7.10» 8.x-dev
Priority:Critical» Normal
Status:Active» Postponed (maintainer needs more info)
Issue tags:+needs backport to D7

The upgrade path reports are duplicate of #966210: DB Case Sensitivity: system_update_7061() fails on inserting files with same name but different case.

If you're getting duplicate key errors for a table other than {file_managed}, this is the wrong issue to post those in.

Everything else here needs explicit steps to reproduce.

Summit’s picture

Hi, I have this error with drupal commerce. Will investigate more.
greetings, Martijn

oteno’s picture

Version:8.x-dev» 7.12

got the same problem with plupload file-upload

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://Bild 14_0.jpg' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, type) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => Bild 14_0.jpg [:db_insert_placeholder_2] => public://Bild 14_0.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 42053 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1329751051 [:db_insert_placeholder_7] => image ) in drupal_write_record() (Zeile 6975 von /ZZZZZZZZ/includes/common.inc).

GinaF’s picture

I have this error when I remove an image and then re-upload the same one. Using Drupal 7.12
(I also have Redirect module installed. )
EDIT: If I try to upload the image again, it usually works the 2nd or 3rd time.

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /drupal/file/ajax/field_image/und/0/form-TyV4aOwONICvlxZyn0D4oT1x21HACFhGwekwp4zAxi8
StatusText: n/a
ResponseText:
Error
Status message
The image was resized to fit within the maximum allowed dimensions of 120x160 pixels.
Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://Chrislett.jpg' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) 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] => 2
[:db_insert_placeholder_1] => Chrislett.jpg
[:db_insert_placeholder_2] => public://Chrislett.jpg
[:db_insert_placeholder_3] => image/jpeg
[:db_insert_placeholder_4] => 3541
[:db_insert_placeholder_5] => 0
[:db_insert_placeholder_6] => 1330339068
)
in drupal_write_record() (line 6975 of /u01/www/vhosts/www..uk/httpdocs/drupal/includes/common.inc).
The website encountered an unexpected error. Please try again later.

ReadyState: undefined

jaypark’s picture

the reported exception was returned when
-uploading of 1 or more images with plupload, media browser plus and media gallery
-uploading of 1 or more images with media browser plus and media gallery
-uploading of 1 or more images with media gallery
-uploading of 1 image, with unique file name, with media gallery

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node://nid/130694' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, type) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => Test Gallery [:db_insert_placeholder_2] => node://nid/130694 [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1330840747 [:db_insert_placeholder_7] => image ) in drupal_write_record() (line 6975 of C:\xampp\htdocs\d7\includes\common.inc).

marvix’s picture

This error is related to php.ini
My site was in sub folder, I copied the site the root, and by mistake I did not copied the php.ini, and I got this error ... I think its something related to the memory !

marvix’s picture

no ... its not related to it :(

asoqa’s picture

I have the same error while uploading files.
But I don't think my problem is due to case insensitive, becase I just upload the same file using FILE_EXISTS_RENAME option in file_save_upload(). And the patches's versions are too many to make me disturbed. So My temporary solution is to override file_save_upload method.

ryumkin’s picture

Subscribe

marcoka’s picture

ryumkin .. in the future check out the green big button on the top right corner saying "Following"

oteno’s picture

i had the same problem. In my case the solution was only the correct configuration of my tmp-directory.

sk8erboi’s picture

Status:Postponed (maintainer needs more info)» Needs review

Getting this...

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fetch_task::og' for key 'PRIMARY': INSERT INTO {cache_update} (cid, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => fetch_task::og [:db_insert_placeholder_1] => 1332581757 ) in _update_create_fetch_task() (line 245 of C:\xampp\htdocs\sevenlanes\modules\update\update.fetch.inc).

mhamed’s picture

The same problem here with drupal 7.12
When ever i ty to add a content after submitting the article or page :
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '20' for key 'PRIMARY': INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) 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); Array ( [:db_insert_placeholder_0] => 20 [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => 1334479473 [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 0 ) in comment_node_insert() (line 1301 of /.../public_html/modules/comment/comment.module).
and an other line:

The website encountered an unexpected error. Please try again later.

marcingy’s picture

Version:7.12» 8.x-dev
Status:Needs review» Postponed (maintainer needs more info)

As per what Catch states in #27 steps on how to recreate are required.

mhamed’s picture

However for me the problem or the bug is in the comment module :
once I disabled the comment module the error disappeared
but has any one got the same

here i ve used the issiu number #3:
http://drupal.org/node/1512962

like this :

<?php
 
/**
 * Implements hook_node_insert().
 */
function comment_node_insert($node) {
   
$node->uid=1;
 
// Allow bulk updates and inserts to temporarily disable the
  // maintenance of the {node_comment_statistics} table.
 
if (variable_get('comment_maintain_node_statistics', TRUE)) {
   
db_insert('node_comment_statistics')
      ->
fields(array(
        
$node->uid=1,
       
'nid' => $node->nid,
       
'cid' => 0,
       
'last_comment_timestamp' => $node->changed,
       
'last_comment_name' => NULL,
       
'last_comment_uid' => $node->uid,
       
'comment_count' => 0,
      ))
      ->
execute();
  }
}
 
?>

adding

<?php
 
$node
->uid=1,
?>

but it throws the following error:
wich is:

Notice: Undefined property: stdClass::$comment_count in comment_node_page_additions() (linea 727 di /home2/wordtosa/public_html/modules/comment/comment.module).
    Notice: Undefined property: stdClass::$comment_count in comment_node_page_additions() (linea 727 di /home2/wordtosa/public_html/modules/comment/comment.module).

using the issiu :

http://drupal.org/node/1020658
and for now with the same actions The error disappeared

aliaric’s picture

subscribe... my problem seems looks like
#23 described. But thats not a solution.

babsOnline’s picture

subscribe

pedrosmoker’s picture

Version:8.x-dev» 7.12
Component:file.module» php.module

"PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://7.jpg' for key 'uri':" YOU will get this ERROR if you will try to upload an image with a specific name for example 7.jpg but on your host an image with the same name is already there!!!!! SOMEBODY HELP PLS!!!

KingSalibah’s picture

I had a similar problem today in trying to figure out how to save files. The file paths weren't being saved correctly using tokens. Eventually it did work, but I kept "removing" the file and reloading it and then I got this error. When I finally figured out the file paths correctly, I created a new node with a different file and it worked. I then deleted the node that I had been "testing" with repeatedly and ensured the doc was deleted in the file path and then re-created the node in a new unit of time and I no longer got this 1062 duplicate entry error. Hope that helps.

maclore’s picture

All I did was to create a new user with administrative privileges and that was all.

kenorb’s picture

The same problem when saving the node:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1337349423 ) in drupal_write_record() (line 7013 of /Users/kenorb/Sites/AAT/docroot/includes/common.inc).
kenorb’s picture

some xdebug stuff:

<?php
                                              
=> $function = 'auto_entitylabel_entity_presave' /includes/module.inc:821    5.5377   40205248                           -> function_exists('auto_entitylabel_entity_presave') /includes/module.inc:822                                                 >=> TRUE    5.5377   40205248                           -> call_user_func_array('auto_entitylabel_entity_presave', array (1 => class stdClass { public $status = 1; public $timestamp = 1337350292; public $filesize = FALSE }, 2 => 'file')) /includes/module.inc:823    5.5378   40205688                             -> auto_entitylabel_entity_presave($entity = class stdClass { public $status = 1; public $timestamp = 1337350292; public $filesize = FALSE }, $type = 'file') /includes/module.inc:0

                                              
=> $result = NULL /includes/module.inc:823    5.5391   40203528                         -> drupal_write_record($table = 'file_managed', $record = class stdClass { public $status = 1; public $timestamp = 1337350292; public $filesize = FALSE }, $

    5.5391   40203528                        
-> drupal_write_record($table = 'file_managed', $record = class stdClass { public $status = 1; public $timestamp = 1337350292; public $filesize = FALSE }, $primary_keys = ???) /includes/file.inc:581
...
                                               =>
$return = 1 /includes/common.inc:7002
    5.5538   40223256                          
-> InsertQuery_mysql->execute() /includes/common.inc:7013
    5.5539   40223256                            
-> InsertQuery->preExecute() /includes/database/mysql/query.inc:17

    5.5553   40224080                            
-> DatabaseConnection->query($query = 'INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2)', $args = array (':db_insert_placeholder_0' => 0, ':db_insert_placeholder_1' => 1, ':db_insert_placeholder_2' => 1337350292), $options = array ('return' => 3, 'target' => 'default')) /includes/database/mysql/query.inc:36

    5.5557   40225808                                
-> PDO->prepare('INSERT INTO file_managed (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2)') /includes/database/database.inc:464

    5.5561   40226856                              
-> DatabaseStatementBase->execute($args = array (':db_insert_placeholder_0' => 0, ':db_insert_placeholder_1' => 1, ':db_insert_placeholder_2' => 1337350292), $options = array ('return' => 3, 'target' => 'default', 'fetch' => 5, 'throw_exception' => TRUE)) /includes/database/database.inc:664
    5.5561   40226904                                
-> is_string(5) /includes/database/database.inc:2120
                                                      
>=> FALSE
    5.5561   40226904                                
-> PDOStatement->setFetchMode(5) /includes/database/database.inc:2127
                                                      
>=> TRUE
    5.5562   40226856                                
-> DatabaseConnection->getLogger() /includes/database/database.inc:2131
                                                      
>=> NULL
                                                    
=> $logger = NULL /includes/database/database.inc:2131
    5.5562   40226904                                
-> PDOStatement->execute(array (':db_insert_placeholder_0' => 0, ':db_insert_placeholder_1' => 1, ':db_insert_placeholder_2' => 1337350292)) /includes/database/database.inc:2136
                                                      
>=>
                                                   =>
$e->query_string = 'INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2)' /includes/database/database.inc:690
                                                  
=> $e->args = array (':db_insert_placeholder_0' => 0, ':db_insert_placeholder_1' => 1, ':db_insert_placeholder_2' => 1337350292) /includes/database/database.inc:692
    5.5962   40373872                
-> DatabaseTransaction->rollback() /modules/node/node.module:1153
?>
kenorb’s picture

Version:7.12» 7.14
5to1’s picture

yeah. i'm having same issue here. 7.14.

i have file field that i have removed from this particular form, because i want to handle this file field upload process in another form but still have files attached as fields in my entity. and use all field logic too.

the thing is that even if i have removed that field_files -element from form, and in my best logic that shouldn't get validated or raise any kind of error.

this is first set of warnings and notices

Warning: array_flip(): Can only flip STRING and INTEGER values! funktiossa DrupalDefaultEntityController->load() (rivi 178 tiedostossa .../drupal/includes/entity.inc).
Notice: Trying to get property of non-object funktiossa file_field_presave() (rivi 220 tiedostossa /Users/janne/Sites/D7-TRUNK/drupal/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri funktiossa file_save() (rivi 570 tiedostossa /Users/janne/Sites/D7-TRUNK/drupal/includes/file.inc).
Notice: Undefined property: stdClass::$filemime funktiossa media_is_type() (rivi 196 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$uri funktiossa media_is_type() (rivi 209 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$filemime funktiossa media_is_type() (rivi 196 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$uri funktiossa media_is_type() (rivi 209 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$filemime funktiossa media_is_type() (rivi 196 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$uri funktiossa media_is_type() (rivi 209 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).
Notice: Undefined property: stdClass::$filemime funktiossa media_is_type() (rivi 196 tiedostossa /Users/janne/Sites/D7-TRUNK/sites/all/modules/media/includes/media.types.inc).

and then:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp, type) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1337859098 [:db_insert_placeholder_3] => default ) funktiossa drupal_write_record() (rivi 7013 tiedostossa /Users/janne/Sites/D7-TRUNK/drupal/includes/common.inc).

which led me here.

i'm not sure if this is the same issue, but it seems that drupal doesn't handle this case that well?

any ideas would be appreciated,

janne

kenorb’s picture

Note: For those who have similar errors in your custom code, such as node_save(), try to add try/catch.
Example:

<?php
 
try {
   
node_save($node);
  } catch (
Exception $e) {
   
watchdog('my_error', $e->getMessage());
  }
?>
zepner’s picture

nice @kenorb

kenorb’s picture

I've another example of this error:

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /Users/kenorb/Sites/AAT/docroot/includes/entity.inc).
Notice: Trying to get property of non-object in file_field_presave() (line 220 of /Users/kenorb/Sites/AAT/docroot/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 570 of /Users/kenorb/Sites/AAT/docroot/includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1337962528 ) in drupal_write_record() (line 7013 of /Users/kenorb/Sites/AAT/docroot/includes/common.inc).

It happens when I'll go to: node/2/workflow and I'll change the workflow state to different one.
Not sure from where it comes and if it's related to Workflow or some other modules.
--
The previous one happens when the node is saved using ctools wizard and even the file wasn't included, following queries were executed:

INSERT INTO file_managed (filesize, status, timestamp) VALUES ('0', '1', '1338310030')
INSERT INTO file_managed (filesize, status, timestamp) VALUES ('0', '1', '1338311731')
darrylh’s picture

I've seen this come up when loading a node with attached files/images, removing one from the node->field_* array, and calling node_save(). This probably only happens when heavy caching is in place.

From a purely logical standpoint - why is file_save() being called when file_load() fails? The check for $file->status being false isn't enough.

Changing the affected area to

<?php
$file
= file_load($item['fid']);
if (
$file !== FALSE && !$file->status) {
?>

works for me.

SaleQuest’s picture

I experienced similar message when import user with User Import Framework.
I had tried to import test files with invalid data and the imports failed.
Believing that I had created bad data in the database, I ended up deleting all of the data in the user fields I had added that were being populated by the import, and tried the import again, it worked with no errors.
Rik

kenorb’s picture

Status:Postponed (maintainer needs more info)» Active
StatusFileSize
new97.43 KB

The error:

Error message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri'

Full xdebug trace of file_field_presave() is in the attachment.
file_field_preview is called with $items argument:

$items = array
  0 =>
    array
      '_weight' => string '0' (length=1)
      'fid' => int 0
      'display' => string '1' (length=1)
      'description' => string '' (length=0)
      'upload_button' => string 'Upload' (length=6)
      'remove_button' => string 'Remove' (length=6)
      'upload' => string '' (length=0)

Field definition in feature:

<?php
  $fields
['node-work_experience-field_wex_file'] = array(
   
'field_config' => array(
     
'active' => '1',
     
'cardinality' => '5',
     
'deleted' => '0',
     
'entity_types' => array(),
     
'field_name' => 'field_wex_file',
     
'foreign keys' => array(
       
'fid' => array(
         
'columns' => array(
           
'fid' => 'fid',
          ),
         
'table' => 'file_managed',
        ),
      ),
     
'indexes' => array(
       
'fid' => array(
         
0 => 'fid',
        ),      ),
     
'module' => 'file',
     
'settings' => array(
       
'display_default' => 1,
       
'display_field' => 1,
       
'profile2_private' => FALSE,
       
'uri_scheme' => 'private',
      ),
     
'translatable' => '0',
     
'type' => 'file',
    ),
   
'field_instance' => array(
     
'bundle' => 'work_experience',
     
'deleted' => '0',
     
'description' => 'You may upload up to 5 documents.',
     
'display' => array(
       
'default' => array(
         
'label' => 'above',
         
'module' => 'file',
         
'settings' => array(),
         
'type' => 'file_default',
         
'weight' => 19,
        ),
       
'teaser' => array(
         
'label' => 'above',
         
'settings' => array(),
         
'type' => 'hidden',
         
'weight' => 0,
        ),
      ),
     
'entity_type' => 'node',
     
'field_name' => 'field_wex_file',
     
'label' => 'Files',
     
'required' => 0,
     
'settings' => array(
       
'description_field' => 0,
       
'file_directory' => 'wex-files',
       
'file_extensions' => 'doc docx xls xlsx pdf odt pages rtf tex txt wpd wps',
       
'max_filesize' => '',
    ),
   
'field_instance' => array(
     
'bundle' => 'work_experience',
     
'deleted' => '0',
     
'description' => 'You may upload up to 5 documents.',
     
'display' => array(
       
'default' => array(
         
'label' => 'above',
         
'module' => 'file',
         
'settings' => array(),
         
'type' => 'file_default',
         
'weight' => 19,
        ),
       
'teaser' => array(
         
'label' => 'above',
         
'settings' => array(),
         
'type' => 'hidden',
         
'weight' => 0,
        ),
      ),
     
'entity_type' => 'node',
     
'field_name' => 'field_wex_file',
     
'label' => 'Files',
     
'required' => 0,
     
'settings' => array(
       
'description_field' => 0,
       
'file_directory' => 'wex-files',
       
'file_extensions' => 'doc docx xls xlsx pdf odt pages rtf tex txt wpd wps',
       
'max_filesize' => '',
       
'user_register_form' => FALSE,
      ),
     
'widget' => array(
       
'active' => 1,
       
'module' => 'file',
       
'settings' => array(
         
'progress_indicator' => 'throbber',
        ),
       
'type' => 'file_generic',
       
'weight' => '24',
      ),
    ),
  );
?>

Saved node object:

Object: stdClass::__set_state(array( 'type' => 'work_experience', 'workflow' => 5, 'status' => 1, 'promote' => 0, 'sticky' => 0, 'uid' => '1', 'created' => 1339162840, 'revision' => false, 'comment' => '0', 'menu' => array ( 'link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => 'main-menu', 'weight' => 0, 'options' => array ( ), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0, 'customized' => 0, 'parent_depth_limit' => 8, ), 'next' => 'Continue', 'field_wex_employment_type' => array ( 'und' => array ( 0 => array ( 'value' => 'employed', ), ), ), 'field_wex_fmaat_verifier_bool' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'form_build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'title' => '%AutoEntityLabel%', 'op' => 'Finish', 'previous' => 'Back', 'field_employment_is_finished' => array ( 'und' => array ( 0 => array ( 'value' => '1', ), ), ), 'field_wex_employment_start_date' => array ( 'und' => array ( 0 => array ( 'value' => '2012-06-08 00:00:00', 'show_todate' => true, 'timezone' => 'Europe/London', 'offset' => 3600, 'offset2' => 3600, 'value2' => '2012-06-08 00:00:00', 'timezone_db' => 'Europe/London', 'date_type' => 'datetime', ), ), ), 'field_wex_job_title' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_no_of_hours_a_week' => array ( 'und' => array ( 0 => array ( 'value' => '2', ), ), ), 'field_wex_no_of_staff' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'field_wex_organisation_name' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_description_duties' => array ( 'und' => array ( 0 => array ( 'value' => 'duties', 'format' => 'filtered_html', ), ), ), 'field_wex_file' => array ( 'und' => array ( 0 => array ( '_weight' => '0', 'fid' => 0, 'display' => '1', 'description' => '', 'upload_button' => 'Upload', 'remove_button' => 'Remove', 'upload' => '', ), ), ), 'in_preview' => true, 'entity_view_prepared' => true, 'return' => 'Finish', ))

Backtrace:

Backtrace: array ( 0 => array ( 'file' => '/Users/kenorb/Sites/AAT/docroot/sites/all/modules/custom/aat_wex/aat_wex.forms.inc', 'line' => 212, 'function' => 'aat_wex_log', 'args' => array ( 0 => 'WEX', 1 => 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry \'\' for key \'uri\'', 2 => stdClass::__set_state(array( 'type' => 'work_experience', 'workflow' => 5, 'status' => 1, 'promote' => 0, 'sticky' => 0, 'uid' => '1', 'created' => 1339162840, 'revision' => false, 'comment' => '0', 'menu' => array ( 'link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => 'main-menu', 'weight' => 0, 'options' => array ( ), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0, 'customized' => 0, 'parent_depth_limit' => 8, ), 'next' => 'Continue', 'field_wex_employment_type' => array ( 'und' => array ( 0 => array ( 'value' => 'employed', ), ), ), 'field_wex_fmaat_verifier_bool' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'form_build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'title' => '%AutoEntityLabel%', 'op' => 'Finish', 'previous' => 'Back', 'field_employment_is_finished' => array ( 'und' => array ( 0 => array ( 'value' => '1', ), ), ), 'field_wex_employment_start_date' => array ( 'und' => array ( 0 => array ( 'value' => '2012-06-08 00:00:00', 'show_todate' => true, 'timezone' => 'Europe/London', 'offset' => 3600, 'offset2' => 3600, 'value2' => '2012-06-08 00:00:00', 'timezone_db' => 'Europe/London', 'date_type' => 'datetime', ), ), ), 'field_wex_job_title' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_no_of_hours_a_week' => array ( 'und' => array ( 0 => array ( 'value' => '2', ), ), ), 'field_wex_no_of_staff' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'field_wex_organisation_name' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_description_duties' => array ( 'und' => array ( 0 => array ( 'value' => 'duties', 'format' => 'filtered_html', ), ), ), 'field_wex_file' => array ( 'und' => array ( 0 => array ( '_weight' => '0', 'fid' => 0, 'display' => '1', 'description' => '', 'upload_button' => 'Upload', 'remove_button' => 'Remove', 'upload' => '', ), ), ), 'in_preview' => true, 'entity_view_prepared' => true, 'return' => 'Finish', )), ), ), 1 => array ( 'file' => '/Users/kenorb/Sites/AAT/docroot/sites/all/modules/contrib/ctools/includes/wizard.inc', 'line' => 156, 'function' => 'aat_wex_wizard_finish', 'args' => array ( 0 => array ( 'ajax' => NULL, 'object_id' => 'aat_wex', 'object' => stdClass::__set_state(array( 'type' => 'work_experience', 'workflow' => 5, 'status' => 1, 'promote' => 0, 'sticky' => 0, 'uid' => '1', 'created' => 1339162840, 'revision' => false, 'comment' => '0', 'menu' => array ( 'link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => 'main-menu', 'weight' => 0, 'options' => array ( ), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0, 'customized' => 0, 'parent_depth_limit' => 8, ), 'next' => 'Continue', 'field_wex_employment_type' => array ( 'und' => array ( 0 => array ( 'value' => 'employed', ), ), ), 'field_wex_fmaat_verifier_bool' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'form_build_id' => 'form-IyB3V0wUYcfsdDMRVjlQj7au-iNu6PSGnTP6B6aFP1c', 'form_token' => 'fUcJQI2Yq1J03Y3C0gsbHmy7FyHc7WtbwFl1eoUQqxY', 'form_id' => 'aat_wex_maat_duties_information', 'title' => '%AutoEntityLabel%', 'op' => 'Continue', 'previous' => 'Back', 'field_employment_is_finished' => array ( 'und' => array ( 0 => array ( 'value' => '1', ), ), ), 'field_wex_employment_start_date' => array ( 'und' => array ( 0 => array ( 'value' => '2012-06-08 00:00:00', 'show_todate' => true, 'timezone' => 'Europe/London', 'offset' => 3600, 'offset2' => 3600, 'value2' => '2012-06-08 00:00:00', ), ), ), 'field_wex_job_title' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_no_of_hours_a_week' => array ( 'und' => array ( 0 => array ( 'value' => '2', ), ), ), 'field_wex_no_of_staff' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'field_wex_organisation_name' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_description_duties' => array ( 'und' => array ( 0 => array ( 'value' => 'duties', 'format' => 'filtered_html', ), ), ), 'field_wex_file' => array ( 'und' => array ( 0 => array ( '_weight' => '0', 'fid' => 0, 'display' => '1', 'description' => '', 'upload_button' => 'Upload', 'remove_button' => 'Remove', 'upload' => '', ), ), ), 'in_preview' => true, 'entity_view_prepared' => true, )), 'build_info' => array ( 'args' => array ( ), 'files' => array ( 'ctools:/includes/wizard.inc' => array ( 'type' => 'inc', 'module' => 'ctools', 'name' => '/includes/wizard', ), 'menu' => 'sites/all/modules/custom/aat_wex/aat_wex.forms.inc', ), ), 'step' => 'preview', 'form_info' => array ( 'id' => 'aat-wex-form', 'path' => 'myaat/services/workexperience/submit/%step', 'show trail' => true, 'show back' => true, 'show cancel' => false, 'show return' => false, 'next callback' => 'aat_wex_wizard_next', 'finish callback' => 'aat_wex_wizard_finish', 'order' => array ( 'step-1' => 'Submit your work experience', 'step-2' => 'About your work experience', 'step-4' => 'Duties information', 'preview' => 'Review this work experience', ), 'forms' => array ( 'step-1' => array ( 'form id' => 'aat_wex_fmaat_employment_type', ), 'step-2' => array ( 'form id' => 'aat_wex_maat_work_experience', ), 'step-3' => array ( 'form id' => 'aat_wex_maat_nominate_your_verifier', ), 'step-4' => array ( 'form id' => 'aat_wex_maat_duties_information', ), 'preview' => array ( 'form id' => 'aat_wex_preview_node', ), ), 'free trail' => false, 'next text' => 'Continue', 'back text' => 'Back', 'return text' => 'Update and return', 'finish text' => 'Finish', 'cancel text' => 'Cancel', ), 'wrapper_callback' => 'ctools_wizard_wrapper', 'rerender' => false, 'temporary' => array ( ), 'programmed' => false, 'cache' => false, 'previous' => 'step-4', 'no_redirect' => true, 'rebuild' => false, 'rebuild_info' => array ( ), 'redirect' => NULL, 'submitted' => true, 'executed' => true, 'method' => 'post', 'groups' => array ( ), 'buttons' => array ( 0 => array ( '#type' => 'submit', '#value' => 'Back', '#next' => 'step-4', '#wizard type' => 'next', '#weight' => -2000, '#limit_validation_errors' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'previous', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'previous', ), '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-previous', ), 1 => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), ), 'input' => array ( 'form_build_id' => 'form-ZyVrq3ES31SDtqQI9BlSD3tiuISHGzzk7YSoOt3hooQ', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'op' => 'Finish', ), 'values' => array ( 'previous' => 'Back', 'return' => 'Finish', 'form_build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'op' => 'Finish', ), 'complete form' => array ( 'ctools_trail' => array ( '#markup' => '<div class="wizard-trail"><span class="wizard-trail-previous">Submit your work experience</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-previous">About your work experience</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-previous">Duties information</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-current">Review this work experience</span></div>', '#weight' => -1000, '#tree' => false, '#parents' => array ( 0 => 'ctools_trail', ), '#array_parents' => array ( 0 => 'ctools_trail', ), '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#id' => 'edit-ctools-trail', '#sorted' => true, '#validated' => true, ), 'buttons' => array ( '#type' => 'actions', '#weight' => 1000, 'previous' => array ( '#type' => 'submit', '#value' => 'Back', '#next' => 'step-4', '#wizard type' => 'next', '#weight' => -2000, '#limit_validation_errors' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'previous', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'previous', ), '#processed' => true, '#required' => false, '#title_display' => 'before', '#id' => 'edit-previous', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), 'return' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => true, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#theme_wrappers' => array ( 0 => 'container', ), '#process' => array ( 0 => 'form_process_actions', 1 => 'form_process_container', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'buttons', ), '#array_parents' => array ( 0 => 'buttons', ), '#processed' => true, '#required' => false, '#attributes' => array ( 'class' => array ( 0 => 'form-actions', ), ), '#title_display' => 'before', '#id' => 'edit-buttons', '#after_build_done' => true, '#validated' => true, ), '#validate' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), 'preview' => array ( '#type' => 'item', '#markup' => ' <article id="node-" class="node node-work-experience clearfix" about="/node/" typeof=""> <header> FIXME: Please theme me in /Users/kenorb/Sites/AAT/docroot/sites/all/themes/aat_v1/node/node--work-experience.tpl.php <h2 property="" datatype=""><a href="/node/">%AutoEntityLabel%</a></h2> </header> <div class="content"> <div class="field field-name-field-wex-employment-type field-type-list-text field-label-above"><div class="field-label">Please confirm if the experience you are submitting is on an employed or self-employed basis:&nbsp;</div><div class="field-items"><div class="field-item even">Employed</div></div></div><div class="field field-name-field-wex-organisation-name field-type-text field-label-above"><div class="field-label">Organisation name:&nbsp;</div><div class="field-items"><div class="field-item even"></div></div></div><div class="field field-name-field-wex-job-title field-type-text field-label-above"><div class="field-label">Your job title:&nbsp;</div><div class="field-items"><div class="field-item even"></div></div></div><div class="field field-name-field-wex-fmaat-verifier-bool field-type-list-boolean field-label-above"><div class="field-label">Please select whether you are nominating a verifier for this work experience:&nbsp;</div><div class="field-items"><div class="field-item even">No</div></div></div><div class="field field-name-field-wex-employment-start-date field-type-datetime field-label-above"><div class="field-label">Employment start date:&nbsp;</div><div class="field-items"><div class="field-item even"><span class="date-display-single" property="dc:date" datatype="xsd:dateTime" content="2012-06-08T00:00:00+01:00">Friday, June 8, 2012</span></div></div></div><div class="field field-name-field-wex-no-of-hours-a-week field-type-list-text field-label-above"><div class="field-label">The number of hours you work a week:&nbsp;</div><div class="field-items"><div class="field-item even">2</div></div></div><div class="field field-name-field-wex-no-of-staff field-type-number-integer field-label-above"><div class="field-label">The number of staff you supervise/employ:&nbsp;</div><div class="field-items"><div class="field-item even">0</div></div></div><div class="field field-name-field-wex-file field-type-file field-label-above"><div class="field-label">Files:&nbsp;</div><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="" title="" src="/modules/file/icons/application-octet-stream.png" /> <a href="http://aat-drupal-clean/" type="; length="></a></span></div></div></div><div class="field field-name-field-wex-description-duties field-type-text-long field-label-above"><div class="field-label">Description of Duties:&nbsp;</div><div class="field-items"><div class="field-item even"><p>duties</p> </div></div></div><div class="field field-name-field-employment-is-finished field-type-list-boolean field-label-above"><div class="field-label">Employment status:&nbsp;</div><div class="field-items"><div class="field-item even">This is my current employment</div></div></div> </div> <footer> </footer> </article> <!-- /.node --> ', '#pre_render' => array ( 0 => 'drupal_pre_render_markup', 1 => 'ctools_dependent_pre_render', ), '#theme_wrappers' => array ( 0 => 'form_element', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'preview', ), '#array_parents' => array ( 0 => 'preview', ), '#weight' => 0.002, '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#id' => 'edit-preview', '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#form_id' => 'aat_wex_preview_node', '#type' => 'form', '#build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_build_id' => array ( '#type' => 'hidden', '#value' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', '#id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', '#name' => 'form_build_id', '#input' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_build_id', ), '#array_parents' => array ( 0 => 'form_build_id', ), '#weight' => 0.003, '#processed' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#token' => 'aat_wex_preview_node', 'form_token' => array ( '#id' => 'edit-aat-wex-preview-node-form-token', '#type' => 'token', '#default_value' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', '#input' => true, '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_token', ), '#array_parents' => array ( 0 => 'form_token', ), '#weight' => 0.004, '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#name' => 'form_token', '#value' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', '#needs_validation' => true, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), 'form_id' => array ( '#type' => 'hidden', '#value' => 'aat_wex_preview_node', '#id' => 'edit-aat-wex-preview-node', '#input' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_id', ), '#array_parents' => array ( 0 => 'form_id', ), '#weight' => 0.005, '#processed' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#name' => 'form_id', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#id' => 'aat-wex-preview-node', '#method' => 'post', '#action' => '/myaat/services/workexperience/submit/preview', '#theme_wrappers' => array ( 0 => 'form', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#tree' => false, '#parents' => array ( ), '#theme' => array ( 0 => 'aat_wex_preview_node', ), '#processed' => false, '#defaults_loaded' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#array_parents' => array ( ), '#after_build_done' => true, '#validated' => true, ), 'process_input' => true, 'triggering_element' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), 'clicked_button' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), 'complete' => true, ), ), ), 2 => array ( 'file' => '/Users/kenorb/Sites/AAT/docroot/sites/all/modules/custom/aat_wex/aat_wex.forms.inc', 'line' => 59, 'function' => 'ctools_wizard_multistep_form', 'args' => array ( 0 => array ( 'id' => 'aat-wex-form', 'path' => 'myaat/services/workexperience/submit/%step', 'show trail' => true, 'show back' => true, 'show cancel' => false, 'show return' => false, 'next callback' => 'aat_wex_wizard_next', 'finish callback' => 'aat_wex_wizard_finish', 'order' => array ( 'step-1' => 'Submit your work experience', 'step-2' => 'About your work experience', 'step-4' => 'Duties information', 'preview' => 'Review this work experience', ), 'forms' => array ( 'step-1' => array ( 'form id' => 'aat_wex_fmaat_employment_type', ), 'step-2' => array ( 'form id' => 'aat_wex_maat_work_experience', ), 'step-3' => array ( 'form id' => 'aat_wex_maat_nominate_your_verifier', ), 'step-4' => array ( 'form id' => 'aat_wex_maat_duties_information', ), 'preview' => array ( 'form id' => 'aat_wex_preview_node', ), ), ), 1 => 'preview', 2 => array ( 'ajax' => NULL, 'object_id' => 'aat_wex', 'object' => stdClass::__set_state(array( 'type' => 'work_experience', 'workflow' => 5, 'status' => 1, 'promote' => 0, 'sticky' => 0, 'uid' => '1', 'created' => 1339162840, 'revision' => false, 'comment' => '0', 'menu' => array ( 'link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => 'main-menu', 'weight' => 0, 'options' => array ( ), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0, 'customized' => 0, 'parent_depth_limit' => 8, ), 'next' => 'Continue', 'field_wex_employment_type' => array ( 'und' => array ( 0 => array ( 'value' => 'employed', ), ), ), 'field_wex_fmaat_verifier_bool' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'form_build_id' => 'form-IyB3V0wUYcfsdDMRVjlQj7au-iNu6PSGnTP6B6aFP1c', 'form_token' => 'fUcJQI2Yq1J03Y3C0gsbHmy7FyHc7WtbwFl1eoUQqxY', 'form_id' => 'aat_wex_maat_duties_information', 'title' => '%AutoEntityLabel%', 'op' => 'Continue', 'previous' => 'Back', 'field_employment_is_finished' => array ( 'und' => array ( 0 => array ( 'value' => '1', ), ), ), 'field_wex_employment_start_date' => array ( 'und' => array ( 0 => array ( 'value' => '2012-06-08 00:00:00', 'show_todate' => true, 'timezone' => 'Europe/London', 'offset' => 3600, 'offset2' => 3600, 'value2' => '2012-06-08 00:00:00', ), ), ), 'field_wex_job_title' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_no_of_hours_a_week' => array ( 'und' => array ( 0 => array ( 'value' => '2', ), ), ), 'field_wex_no_of_staff' => array ( 'und' => array ( 0 => array ( 'value' => '0', ), ), ), 'field_wex_organisation_name' => array ( 'und' => array ( 0 => array ( 'value' => '', ), ), ), 'field_wex_description_duties' => array ( 'und' => array ( 0 => array ( 'value' => 'duties', 'format' => 'filtered_html', ), ), ), 'field_wex_file' => array ( 'und' => array ( 0 => array ( '_weight' => '0', 'fid' => 0, 'display' => '1', 'description' => '', 'upload_button' => 'Upload', 'remove_button' => 'Remove', 'upload' => '', ), ), ), 'in_preview' => true, 'entity_view_prepared' => true, )), 'build_info' => array ( 'args' => array ( ), 'files' => array ( 'ctools:/includes/wizard.inc' => array ( 'type' => 'inc', 'module' => 'ctools', 'name' => '/includes/wizard', ), 'menu' => 'sites/all/modules/custom/aat_wex/aat_wex.forms.inc', ), ), 'step' => 'preview', 'form_info' => array ( 'id' => 'aat-wex-form', 'path' => 'myaat/services/workexperience/submit/%step', 'show trail' => true, 'show back' => true, 'show cancel' => false, 'show return' => false, 'next callback' => 'aat_wex_wizard_next', 'finish callback' => 'aat_wex_wizard_finish', 'order' => array ( 'step-1' => 'Submit your work experience', 'step-2' => 'About your work experience', 'step-4' => 'Duties information', 'preview' => 'Review this work experience', ), 'forms' => array ( 'step-1' => array ( 'form id' => 'aat_wex_fmaat_employment_type', ), 'step-2' => array ( 'form id' => 'aat_wex_maat_work_experience', ), 'step-3' => array ( 'form id' => 'aat_wex_maat_nominate_your_verifier', ), 'step-4' => array ( 'form id' => 'aat_wex_maat_duties_information', ), 'preview' => array ( 'form id' => 'aat_wex_preview_node', ), ), 'free trail' => false, 'next text' => 'Continue', 'back text' => 'Back', 'return text' => 'Update and return', 'finish text' => 'Finish', 'cancel text' => 'Cancel', ), 'wrapper_callback' => 'ctools_wizard_wrapper', 'rerender' => false, 'temporary' => array ( ), 'programmed' => false, 'cache' => false, 'previous' => 'step-4', 'no_redirect' => true, 'rebuild' => false, 'rebuild_info' => array ( ), 'redirect' => NULL, 'submitted' => true, 'executed' => true, 'method' => 'post', 'groups' => array ( ), 'buttons' => array ( 0 => array ( '#type' => 'submit', '#value' => 'Back', '#next' => 'step-4', '#wizard type' => 'next', '#weight' => -2000, '#limit_validation_errors' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'previous', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'previous', ), '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-previous', ), 1 => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), ), 'input' => array ( 'form_build_id' => 'form-ZyVrq3ES31SDtqQI9BlSD3tiuISHGzzk7YSoOt3hooQ', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'op' => 'Finish', ), 'values' => array ( 'previous' => 'Back', 'return' => 'Finish', 'form_build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_token' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', 'form_id' => 'aat_wex_preview_node', 'op' => 'Finish', ), 'complete form' => array ( 'ctools_trail' => array ( '#markup' => '<div class="wizard-trail"><span class="wizard-trail-previous">Submit your work experience</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-previous">About your work experience</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-previous">Duties information</span> <span class="wizard-seperator">»</span> <span class="wizard-trail-current">Review this work experience</span></div>', '#weight' => -1000, '#tree' => false, '#parents' => array ( 0 => 'ctools_trail', ), '#array_parents' => array ( 0 => 'ctools_trail', ), '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#id' => 'edit-ctools-trail', '#sorted' => true, '#validated' => true, ), 'buttons' => array ( '#type' => 'actions', '#weight' => 1000, 'previous' => array ( '#type' => 'submit', '#value' => 'Back', '#next' => 'step-4', '#wizard type' => 'next', '#weight' => -2000, '#limit_validation_errors' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'previous', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'previous', ), '#processed' => true, '#required' => false, '#title_display' => 'before', '#id' => 'edit-previous', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), 'return' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => true, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#theme_wrappers' => array ( 0 => 'container', ), '#process' => array ( 0 => 'form_process_actions', 1 => 'form_process_container', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'buttons', ), '#array_parents' => array ( 0 => 'buttons', ), '#processed' => true, '#required' => false, '#attributes' => array ( 'class' => array ( 0 => 'form-actions', ), ), '#title_display' => 'before', '#id' => 'edit-buttons', '#after_build_done' => true, '#validated' => true, ), '#validate' => array ( ), '#submit' => array ( 0 => 'ctools_wizard_submit', ), 'preview' => array ( '#type' => 'item', '#markup' => ' <article id="node-" class="node node-work-experience clearfix" about="/node/" typeof=""> <header> FIXME: Please theme me in /Users/kenorb/Sites/AAT/docroot/sites/all/themes/aat_v1/node/node--work-experience.tpl.php <h2 property="" datatype=""><a href="/node/">%AutoEntityLabel%</a></h2> </header> <div class="content"> <div class="field field-name-field-wex-employment-type field-type-list-text field-label-above"><div class="field-label">Please confirm if the experience you are submitting is on an employed or self-employed basis:&nbsp;</div><div class="field-items"><div class="field-item even">Employed</div></div></div><div class="field field-name-field-wex-organisation-name field-type-text field-label-above"><div class="field-label">Organisation name:&nbsp;</div><div class="field-items"><div class="field-item even"></div></div></div><div class="field field-name-field-wex-job-title field-type-text field-label-above"><div class="field-label">Your job title:&nbsp;</div><div class="field-items"><div class="field-item even"></div></div></div><div class="field field-name-field-wex-fmaat-verifier-bool field-type-list-boolean field-label-above"><div class="field-label">Please select whether you are nominating a verifier for this work experience:&nbsp;</div><div class="field-items"><div class="field-item even">No</div></div></div><div class="field field-name-field-wex-employment-start-date field-type-datetime field-label-above"><div class="field-label">Employment start date:&nbsp;</div><div class="field-items"><div class="field-item even"><span class="date-display-single" property="dc:date" datatype="xsd:dateTime" content="2012-06-08T00:00:00+01:00">Friday, June 8, 2012</span></div></div></div><div class="field field-name-field-wex-no-of-hours-a-week field-type-list-text field-label-above"><div class="field-label">The number of hours you work a week:&nbsp;</div><div class="field-items"><div class="field-item even">2</div></div></div><div class="field field-name-field-wex-no-of-staff field-type-number-integer field-label-above"><div class="field-label">The number of staff you supervise/employ:&nbsp;</div><div class="field-items"><div class="field-item even">0</div></div></div><div class="field field-name-field-wex-file field-type-file field-label-above"><div class="field-label">Files:&nbsp;</div><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="" title="" src="/modules/file/icons/application-octet-stream.png" /> <a href="http://aat-drupal-clean/" type="; length="></a></span></div></div></div><div class="field field-name-field-wex-description-duties field-type-text-long field-label-above"><div class="field-label">Description of Duties:&nbsp;</div><div class="field-items"><div class="field-item even"><p>duties</p> </div></div></div><div class="field field-name-field-employment-is-finished field-type-list-boolean field-label-above"><div class="field-label">Employment status:&nbsp;</div><div class="field-items"><div class="field-item even">This is my current employment</div></div></div> </div> <footer> </footer> </article> <!-- /.node --> ', '#pre_render' => array ( 0 => 'drupal_pre_render_markup', 1 => 'ctools_dependent_pre_render', ), '#theme_wrappers' => array ( 0 => 'form_element', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'preview', ), '#array_parents' => array ( 0 => 'preview', ), '#weight' => 0.002, '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#id' => 'edit-preview', '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#form_id' => 'aat_wex_preview_node', '#type' => 'form', '#build_id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', 'form_build_id' => array ( '#type' => 'hidden', '#value' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', '#id' => 'form-yK4XApIJw-kWYJZduWtYe4xGExCgTr5wnbd92Sk5pM8', '#name' => 'form_build_id', '#input' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_build_id', ), '#array_parents' => array ( 0 => 'form_build_id', ), '#weight' => 0.003, '#processed' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#token' => 'aat_wex_preview_node', 'form_token' => array ( '#id' => 'edit-aat-wex-preview-node-form-token', '#type' => 'token', '#default_value' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', '#input' => true, '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_token', ), '#array_parents' => array ( 0 => 'form_token', ), '#weight' => 0.004, '#processed' => false, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#name' => 'form_token', '#value' => 'po4VDq8U3X2LtnBI10zjOiG9KQyh2swX0a2o1CXqjXM', '#needs_validation' => true, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), 'form_id' => array ( '#type' => 'hidden', '#value' => 'aat_wex_preview_node', '#id' => 'edit-aat-wex-preview-node', '#input' => true, '#process' => array ( 0 => 'ajax_process_form', ), '#theme' => 'hidden', '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'form_id', ), '#array_parents' => array ( 0 => 'form_id', ), '#weight' => 0.005, '#processed' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#name' => 'form_id', '#ajax_processed' => false, '#sorted' => true, '#after_build_done' => true, '#validated' => true, ), '#id' => 'aat-wex-preview-node', '#method' => 'post', '#action' => '/myaat/services/workexperience/submit/preview', '#theme_wrappers' => array ( 0 => 'form', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#tree' => false, '#parents' => array ( ), '#theme' => array ( 0 => 'aat_wex_preview_node', ), '#processed' => false, '#defaults_loaded' => true, '#required' => false, '#attributes' => array ( ), '#title_display' => 'before', '#array_parents' => array ( ), '#after_build_done' => true, '#validated' => true, ), 'process_input' => true, 'triggering_element' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), 'clicked_button' => array ( '#type' => 'submit', '#value' => 'Finish', '#wizard type' => 'finish', '#attributes' => array ( ), '#input' => true, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => true, '#limit_validation_errors' => false, '#process' => array ( 0 => 'ajax_process_form', ), '#theme_wrappers' => array ( 0 => 'button', ), '#after_build' => array ( 0 => 'conditional_fields_element_after_build', ), '#defaults_loaded' => true, '#tree' => false, '#parents' => array ( 0 => 'return', ), '#array_parents' => array ( 0 => 'buttons', 1 => 'return', ), '#weight' => 0.001, '#processed' => false, '#required' => false, '#title_display' => 'before', '#id' => 'edit-return', ), 'complete' => true, ), ), ), 3 => array ( 'function' => 'aat_wex_form', 'args' => array ( 0 => 'preview', ), ), 4 => array ( 'file' => '/Users/kenorb/Sites/AAT/docroot/includes/menu.inc', 'line' => 516, 'function' => 'call_user_func_array', 'args' => array ( 0 => 'aat_wex_form', 1 => array ( 0 => 'preview', ), ), ), 5 => array ( 'file' => '/Users/kenorb/Sites/AAT/docroot/index.php', 'line' => 21, 'function' => 'menu_execute_active_handler', 'args' => array ( ), ), )

The error happens on: node_save($node);
The form is created by ctools wizard with 5 multipage steps. The 4th step include the file field, but during the testing I didn't upload anything.

kenorb’s picture

Component:php.module» file.module
kenorb’s picture

Status:Needs review» Active

In addition, following code:

<?php
function file_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
// ...
   
$file = file_load($item['fid']);
    if (!
$file->status) {
     
var_dump(!$file->status);
     
var_dump($file);
      exit;
?>

returns:

boolean true
boolean false

Which means !$file->status returns TRUE, even file_load(0); returned FALSE.
Tested on PHP 5.2.17 and 5.3.6

kenorb’s picture

StatusFileSize
new520 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc_.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

It looks like solution from #54 works.
Find the patch in the attachment.

kenorb’s picture

Status:Active» Needs review

Status:Active» Needs work

The last submitted patch, file.field_.inc_.patch, failed testing.

kenorb’s picture

StatusFileSize
new534 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc-1163740.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
kenorb’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, file.field_.inc-1163740.patch, failed testing.

arelem’s picture

June 9 2012
Drupal 7.12, all updated modules, with a copy of the server installation on my home machine, both Fedora 16 and Ubuntu Precise.

I found that /sites/default/files, for me in Fedora 16, I had to sudo chown apache:myusername files and the fault disappears.
In Ubuntu I had to sudo chown www-data:myusername files
I have also found that the file /colors in /sites/default/files has to have the same ownership as /files and /ctools in both.
A fresh drupal install does not seem to have this problem.
I hope this helps someone else.

kenorb’s picture

Status:Needs work» Needs review
StatusFileSize
new508 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file.field_.inc-1163740_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
shaostudio’s picture

Component:file.module» other

I received the same error when trying to save a new view with/without a block. Working with WAMP on a test site. Strange because I've been making and saving views with no issues before.

#66 patch did not work for me. I also deleted corrupt view in database before applying patch.

Update:
Possible fix or just a fluke. After three attempts at trying to make a new view and saving I kept getting the same errors. When I went to the Views list it wouldn't let me delete the view. So I went back to my error page and refreshed it, and surprise no error! I was even allowed to delete the view. My new saved view has no errors so far...

himagarwal’s picture

I am having the same issue when uploading a file.

kenorb’s picture

Component:other» file.module

@aneko if you have received this error using Views, please report separate issue against Views module, because the same error doesn't mean the same problem. This one is related to Drupal core and patch is working for those who are experiencing the same problem.

alauzon’s picture

#62: file.field_.inc-1163740.patch queued for re-testing.

coolhandlukek2’s picture

#Subscribe

kenorb’s picture

svergeylen’s picture

Subscribe. I've got the same :-( With Rules active

kmonty’s picture

Patch #66 did not work for me either.

Background: I also am in the process of upgrading a Drupal 6 site to D7 Panopoly and am receiving this error whenever I upload a file with the same filename of an already uploaded file to an image field. New files with unique filenames are not a problem. Interestingly enough, even the though the error appears, the file is uploaded to my sites/default/files directory + inserted into the DB. If I save the node and edit it again, it appears in my image field list.

I have a bunch of modules enabled that could be effecting this (filefield_sources, insert, transliteration, content_lock, save_draft, redirect), but I've disabled all related modules and the error persists.

I'll try messing around with killing node_revision (I see that mentioned in other issues) and will report back in I have any luck. Happy to run any tests/assist in debugging in any way deemed helpful.

kmonty’s picture

I found my issue #1556396: Refactor file.inc to make it simpler and prevent PDO exceptions

Perhaps mark this thread as a duplicate?

sourcesoft’s picture

#66 worked for me. Ajax pop-up error is gone during filefield upload in nodes. This was a critical bug.

pwhite’s picture

I started having this problem on a website when editing nodes with a lot of images that had been imported. To fix I installed the filefield_paths module then set the field of the image to change the filename to a random hash, I then ticked a box to retrospectively update all paths (this took a while). Now when a file it uploaded the filename automatically gets given a random hash.

irohit786’s picture

same problem, anyone found a define solution yet?? Please respond if answer is affirmative??

mgifford’s picture

I got this error too. Went to the issue that @kmonty pointed to and got a good response:
https://drupal.org/node/1556396#comment-6411492

Life was so much simpler before database abstraction.... That being said, best to keep this issue open.

@irohit786 did you try the patch in #66?

Dave Reid’s picture

aadilali’s picture

Hi,
When i try to activate any module or install new module. I found an error.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' contextConditionNodeTest-Class' for key 1: Insert INTO {register}(name,type, filename, module,weight) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2,:db_insert_placeholder_3,....................... ....................................................

can anyone solve this problem?

irohit786’s picture

@mgifford: No dear..I was a little short of time and was looking for a quick fix..fortunately I got the root of the error in my project it was the remember me module which was trying to insert all zero values in the file managed table while a user logs in and hence thwrowing "duplicate entry error" I removed the module and things are just fine now.. :) Checkout for the newly installed contributed modules.. may be you too get lucky!! Hope this helps..

mgifford’s picture

Thanks @irohit786

This is the issue you ran into here #1071330: Remember me wipes out user data (file field) after login

Good reminder to disable modules to track down the source.

pigpenn’s picture

This is unbelievable! there are 4 or 5 threads about this issue all claiming that it is this or that module. I can't believe that just installing a module hoses the whole install and that that! No answers ...

Drupal 7 == Windows Millennium Edition (ME).

Drupal use to be for smart people and good coders, now it is like medicine or the law made intentionally complex to feed the egos of weak scared people.

Drupal 7 == 1974 FORD LTD

marcingy’s picture

@pigpenn drupal is built by volunteers, so instead of posting unconstructive comments why not help track down the course of the issue or review the posted patch as obviously you are encountering the issue.

bensoi’s picture

i second that @marcingy. Drupal is open source. all are volunteers and no one has the right to complain. in my experience, Drupal community is kind enough to show me how to do things the right way.

kenorb’s picture

@pigpenn:
This issue is actual MySQL database error, not Drupal it-self and it's too general to tell exactly what happened. So there can be even 100 threads of the same error, each can be caused by something else.
Sometimes it's caused as it's stated by 'Integrity constraint violation', so please use only one Tab at a time and don't refresh/re-post your page again, because probably your record has been already created.
It's best to not install too many modules at once. Start from scratch and install only stable modules with more than 1000 usage statistics and check if the error happens again.
If you are not developer, please use Forum, you'll find there simple solutions to your problems.

nicholasstuartwilson’s picture

Disabling the 'View Unpublished' module got rid of this error for me. Now I need to work out why that module causes the error....

JeffBrower’s picture

Issue tags:-needs backport to D7

I get the same error but not for any of the above modules or reasons, which makes me think it is a MySQL error. I am using db_merge with the expectation that the module will see if there is a duplicate and if such is found, do an update rather than an insert. It appears that (unless there is an error here I am not seeing) it is deciding that there is not a duplicate and doing an insert - and the insert is what is throwing the error. The key here is the exact unique key on the schema in my module.

Since the title of this thread is the exact message I am getting and is currently active I decide to add the issue here, but perhaps I need to add it with db_merge in the title of a new issue. Please advise or feel free to cross-post/move it if that is appropriate - I just do not want to create duplication and confusion.

Here is the snippet and the result I am seeing:

<?php
           
try {
               
db_merge('Results')
                   ->
key(array('item_seller_id'         => $insert_array['item_seller_id'],
                              
'item_product_id_seller' => $insert_array['item_product_id_seller'],
                              
'item_date'              => $insert_array['item_date']))
                   ->
fields($insert_array)
                   ->
execute();
            }
            catch (
Exception $e) {
               
// Something went wrong somewhere, so roll back now.
               
$txn->rollback();
               
// Display the error to the user
               
drupal_set_message(t('The database had a failure: ') . $e, 'error');
                return
FALSE;
            }
           
drupal_set_message(t('---The item has been captured in the database.'));
?>

Results in:
The database had a failure: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

marcingy’s picture

Issue tags:+needs backport to D7

Fixing tags

marcingy’s picture

Version:7.14» 8.x-dev
Gastonia’s picture

Version:8.x-dev» 7.15

I am getting the same error as stated in the title of this thread, but I think I have found the problem and how to fix it.

I created a script to batch create nodes based on data I have in a spreadsheet file. If there are images, then those are handled accordingly. Here is a small excerpt from my $file object when saving a node:

                                        $file = new stdClass();
$file -> uid = $this->uid;
$file -> filename = basename($local_path);
$file -> filemime = $mime;
$file -> filesize = filesize($local_path);
$file -> status = FILE_STATUS_PERMANENT;

$file = file_copy($file, 'public://', FILE_EXISTS_RENAME);

The error, I believe, is in the file_copy() function. file_copy() checks if the file exists and renames accordingly. However, what is does not do is check if that unique filename already has an entry in the database (url field of the file_managed table).

The reason this is happening is the file names in the public:// directory are out of sync with what is reported in the database. Theoretically, if you have image1.jpg in the file folder and public://image1.jpg in the uri field, then the renaming strategy for file_copy should work fine. But what happens when image1.jpg actually gets deleted (for whatever reason)? Then the next file that comes along is image1.jpg. Because it actually does not exists in the file folder, file_copy does not rename it and it populates $file->uri with public://image1.jpg. And then we get the error as shown in the title.

I think adding the validation logic to file_copy() (or whichever function should handle that logic) to not only check if the filename is unique to the files in the folder, but also in this table, will solve the problem. Indeed it has solved it for me.

In my script I append a unique string to the end of my title before I let file_copy manage it to avoid this alltogether.

marcingy’s picture

Version:7.15» 8.x-dev

Please do not change version things get fixed in d8 first.

el1_1el’s picture

I am having the exact same problem as Gastonia but using file_save() instead

if (!file_exists($finalfile)) {
...
  //Check for previous files in drupal array/object
  $transformfile= field_get_items('node', $node, 'field_file_transforms');
  $numoftransformfiles=count($transformfile);
  if(!$transformfile){
$numoftransformfiles="0";
  }
  //Build new fileobject for created file
  $file = new stdClass();
  $file->filename = $filename . '_.xml';
  $file->filepath = $finalfile;
  $file->filemime = file_get_mimetype($finalfile);
  $file->filesize = filesize($finalfile);
  $file->uid = $user->uid;
  $file->status = FILE_STATUS_PERMANENT;
  $file->uri = $finalfile;
  $file->display = '1';
  $file->description = '';
  $file->new = TRUE;
  //Save the new file object and put in drupal filefield
  file_save($file);
  $node->field_file_transforms[LANGUAGE_NONE][$numoftransformfiles] = (array)$file;
...
}

If the file is deleted via ftp I get "PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sites/default/files/projects/...' for key 'uri': INSERT INTO {file_managed}...

I can't seem to find a function to check if uri exists and then update the record.. or maybe just delete the record and build a new one....I could generate a unique name as Gastonia did but then the old record never gets cleaned up in files_managed table. A check via a SQL statement seems excessive but does anyone have a better solution?

krylov’s picture

I think it's a concurrency issue when D7 makes a file object in db. I have written a module that fixes the problem and lets you do other checks on the uploaded file.

https://drupal.org/project/upload_qc

mgifford’s picture

Issue tags:-needs backport to D7

#66: file.field_.inc-1163740.patch queued for re-testing.

Status:Needs review» Needs work
Issue tags:+needs backport to D7

The last submitted patch, file.field_.inc-1163740.patch, failed testing.

JonAnthony’s picture

#subscribe

chertzog’s picture

#100 Fixed my problems in D7.

Barry Tielkes’s picture

Version:8.x-dev» 7.18

Thanks!

#100 Fixed my error to on D7.18
Media module 7.x-2.0-unstable7+4-dev
Field collection 7.x-1.0-beta4
Display Suite 7.x-2.0

(with i18n, for a multilang site.)

aya.y’s picture

Status:Needs work» Fixed

Thank u chertzog #100 Fixed my problems in D7.

lyricnz’s picture

Version:7.18» 8.x-dev
Status:Fixed» Needs work

Barry76: Do not change the version number of the Bug. Things get fixed in Drupal 8.x-dev first, then back-ported to Drupal 7.x-dev.

aya.y: Do not change status to "fixed" - this means that the issue has been fixed in the Drupal source repository, not that it works for you.

Setting status to "needs work" until there is a D8-valid patch to review.

j0rd’s picture

#100 did not resolve my issues in Drupal 7.18. I'm using feeds alpha7 to import nodes, which have image/file fields, set as optional, but not included in the feeds import.

j0rd’s picture

I've managed to get my feeds code to work with regards to #105.

I was attempting to add default image avatars to new nodes, through hardcoded FIDs, but these images had been deleted due to file_managed usage = 0 previously and I didn't notice. I've re-added them, and now my imports work fine.

Sorry for the false alarm. Ignore #105, although better error warnings would have made this easier to debug.

j0rd’s picture

StatusFileSize
new1004 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-integrity-violation-fix-both-1163740-107.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
j0rd’s picture

StatusFileSize
new1.38 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-integrity-violation-fix-both-1163740-108.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Another D7 patch. Previous patch had bad paths. Here's a merge of these three (new is Dave Reid's unset fix in presave) to prevent PDO warnings. Might want to add a watchdog though, as not everything will fail silently.

Dave Reid fix for: We actually need to unset $items[$delta] if the file is invalid otherwise we'll get fatal errors: "PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'fid' cannot be null"
http://drupal.org/node/1443158#comment-6231824
http://drupal.org/files/1443158-file-field-presave-D7-do-not-test.patch

jenlampton fix for: empty file fields. At the time file_field_presave is run $items is just an empty array for me, so the patch #1443158: file_field_presave assumes that a file object has been loaded makes no difference in this case.
http://drupal.org/node/1627860#comment-6788650
http://drupal.org/files/core-save_upgraded_empty_fields-please-1627860-1...

kenorb: patch #65 from this issue
http://drupal.org/files/file.field_.inc-1163740_0.patch

kenorb’s picture

The last submitted patch, file-integrity-violation-fix-both-1163740-108.patch, failed testing.

hwasem’s picture

Status:Needs review» Needs work

I upgraded to Drupal 7.19 and manually applied the patch in #108. All initial testing shows this fixed my problem adding new content without an image field item. Thank you so much!

jefflinwood’s picture

I can also confirm that the patch in #108 works with an upgrade of a Drupal 6 site with an image field in some of the content types and some nodes without images to Drupal 7.19.

GiorgosK’s picture

tried patch from #108 and even patch from #17 #1443158: (Followup: tests) file_field_presave and file_field_insert assume that a file object has been loaded but had no luck

I get following error when I try to upload a file on file field (drupal 7.19)

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://033_96.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, origname) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 033.jpg [:db_insert_placeholder_2] => public://033_96.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 56281 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1361316064 [:db_insert_placeholder_7] => 033.jpg ) in drupal_write_record() (line 7106 of /home/domain/abc/prod/htdocs/includes/common.inc).

on the other hand installing and enabling https://drupal.org/project/upload_qc took away the problem

hwasem’s picture

I just updated to 7.21 and had to reapply patch #108 (the one that failed Simple Test). I tried the updated link in #109, but that did not work for me even after clearing cache. Will the patch in #108 be added to core?

gandhi.pranav.66’s picture

I am working on my site for display single node and when i revert back my changes suddenly give below error.

I have WAMP server with window 7.

Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'slideshow/js/views_slideshow.js' for key 'file': INSERT INTO {core_library_stat} (file, hits, hits_anonymous, hits_admin, module, type) 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); Array ( [:db_insert_placeholder_0] => slideshow/js/views_slideshow.js [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => views [:db_insert_placeholder_5] => js ) in drupal_write_record() (line 6868 of E:\wamp\www\leolive\includes\common.inc).
Additional

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'css/views.css' for key 'file': INSERT INTO {core_library_stat} (file, hits, hits_anonymous, hits_admin, module, type) 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); Array ( [:db_insert_placeholder_0] => css/views.css [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => views [:db_insert_placeholder_5] => css ) in drupal_write_record() (line 6868 of E:\wamp\www\leolive\includes\common.inc).

is there any way to get out of this? Because of this my site was struck.

Xsander’s picture

[removed]

clashar’s picture

please delete #116, it's very very bad and abusive russian language about drupal

batigolix’s picture

removed contents of comment #116

huythuan’s picture

I have the same issue when I am trying migrate field from drupal 6 to drupal 7. Look at my issue:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=19&op=do StatusText: error ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://story_art/costadeoro-tastingroom_lores.jpg' for key 'uri': INSERT INTO {file_managed} (fid, uid, filename, uri, filemime, filesize, status, timestamp) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 4111 [:db_insert_placeholder_1] => 6 [:db_insert_placeholder_2] => costadeoro-tastingroom_lores.jpg [:db_insert_placeholder_3] => public://story_art/costadeoro-tastingroom_lores.jpg [:db_insert_placeholder_4] => image/jpeg [:db_insert_placeholder_5] => 209319 [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => 1269971750 ) in content_migrate_filefield_data_record_alter() (line 280 of /Applications/MAMP/htdocs/wctw_git/sites/all/modules/contrib/cck/modules/content_migrate/modules/content_migrate.filefield.inc).
This issue will cause images disappear in some nodes which its image upload fields have not migrated
My Solution is:
Go to database, search for table: files and delete the row which have fid: 4111 in my case. In other cases you can find the row on your error message. My error message: ...[:db_insert_placeholder_0] => 4111 [:db_insert_placeholder_1] => 6 [:db_insert_placeholder_2] => costadeoro-tastingroom_lores.jpg ....

Hope this can help

huythuan’s picture

I have the same issue when I am trying migrate field from drupal 6 to drupal 7. Look at my issue:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=19&op=do StatusText: error ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://story_art/costadeoro-tastingroom_lores.jpg' for key 'uri': INSERT INTO {file_managed} (fid, uid, filename, uri, filemime, filesize, status, timestamp) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 4111 [:db_insert_placeholder_1] => 6 [:db_insert_placeholder_2] => costadeoro-tastingroom_lores.jpg [:db_insert_placeholder_3] => public://story_art/costadeoro-tastingroom_lores.jpg [:db_insert_placeholder_4] => image/jpeg [:db_insert_placeholder_5] => 209319 [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => 1269971750 ) in content_migrate_filefield_data_record_alter() (line 280 of /Applications/MAMP/htdocs/wctw_git/sites/all/modules/contrib/cck/modules/content_migrate/modules/content_migrate.filefield.inc).
This issue will cause images disappear in some nodes which its image upload fields have not migrated
My Solution is:
Go to database, search for table: files and delete the row which have fid: 4111 in my case. In other cases you can find the row on your error message. My error message: ...[:db_insert_placeholder_0] => 4111 [:db_insert_placeholder_1] => 6 [:db_insert_placeholder_2] => costadeoro-tastingroom_lores.jpg ....

Hope this can help

hoebekewim’s picture

If you encounter this issue while importing nodes it might help to run a field_cache_clear() before importing the nodes.

Summit’s picture

Hi,
I think my situation is almost the same as https://drupal.org/node/1163740#comment-5429444.
For me the error occurs with Commerce Feeds. It has to do with a Image file which is already there, but the feed importer want to put there again.
This patch worked for me https://drupal.org/node/1443158#comment-6955596
Greetings, Martijn

iyia12co’s picture

Version:8.x-dev» 7.x-dev

Recently had a similar error message:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '

This happened after I deleted a bunch of nodes containing a file field and then attempted to add new nodes containing the former files. Flushing all caches did the trick for me.

I suppose the permanent fix (in this case) would be to trigger a cache clear upon deletion or to ensure that the cache component is deleted simultaneously with the file itself.

Best regards

liquidcms’s picture

Version:8.x-dev» 7.x-dev

just my update:
- tried D7.23: bug is still in core.. :(
- tried upload_qc module (#96); this did not work
- tried patch in #108: this worked

marcingy’s picture

Version:7.x-dev» 8.x-dev

Please do not change versions

mgifford’s picture

@marcingy - agreed, but... What was the last D8 patch in this queue? There hasn't been one that I could see.

This issue hasn't made much progress in D8 and is still stopping folks in D7. I was trying to track down if there is any code relationship between the last patch & D8 and really didn't find any commonality.

Perhaps this is a case where it isn't appropriate to wait till we fix it in D8, before addressing it in D7. There do seem to be useful patches proposed for D7.

hwasem’s picture

I, too, am not clear on how things get officially patched in core D7. I do understand wanting to make sure this is not in D8 or at least is fixed, but I'm hesitant in going live in D7 with a bug that won't allow new content to be added without an image. This is a show stopper for me with each D7 upgrade and I need to reapply patch #108 each time.

@liquidcms, did you mean patch #108 worked? I don't see a patch on comment #10.

liquidcms’s picture

Version:7.x-dev» 8.x-dev

yes, typo.. i fixed my post now to say #108. thanks.

ressa’s picture

I import a Feed every other day, overwriting existing nodes, and I was getting lots of these errors in my logs:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-80160-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_body} [...] field_sql_storage_field_storage_write() (line 451 of /srv/www/website/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

AND

exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://prod_img/06e397b26eb7363e7327dd586c80b4d3299f5d78_5.jpg' for key 'uri'' in /srv/www/website/public_html/includes/database/database.inc:2168

The patch from #108 fixes the issue and all feed items are imported without errors. Perhaps it's ready to be committed to D7?

EDIT: I spoke too soon, I still get PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry...

prezaeis’s picture

guys today after trying to add a content of a particular content type i got the error below, all other content types work fine.

recently we moved from another web server to a new dedicated server. could this have caused this? ive made sure files folder has permission 777
i can see that everything in the root folder and all subdirectories are owned by user 'ftp' and group 'ftp'

these correct? i dont think it would be a permission issuem its database related correct? sorry my knowledge isnt great here

i really appreciate any help, im desperate

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3252-0-all' for key 'PRIMARY': INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) 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); Array ( [:db_insert_placeholder_0] => 3252 [:db_insert_placeholder_1] => all [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) in node_access_write_grants() (line 3551 of /var/www/html/modules/node/node.module).

NOTE: THIS ONLY HAPPENS WHEN I POST FROM A USER ACCOUNT WITH ADMIN ROLE. NORMAL ROLES CAN POST WITHOUT PROBLEM!!!!!!!

marcingy’s picture

@prezaeis your issue is totally different from the issue here. Please create a new issue for your problem which is do with node_access table.

ressa’s picture

I deleted the image folder, changed the name of it and let the system regenerate it, and it now seems to work fine, with both user and owner as www-data:www-data.

breathingrock’s picture

If anyone is still wondering why this might happen, we encountered the issue when a file field referenced a file that no longer existed. Make sure you're file references are clean, and you'll avoid at least one cause of this problem.

revagomes’s picture

Status:Needs work» Needs review
StatusFileSize
new918 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file-Integrity_constraint_violation-1163740-134.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

In order to prevent this issue the easiest way I found is replace the $counter++ in the file_create_filename() function to time().

This way we will ensure that each file will have an unique filename, even if for some reason the file vanish from the filesystem and its entry in file_managed table is still there .

This is a Drupal 7 patch. D8 version is comming.

Status:Needs review» Needs work

The last submitted patch, file-Integrity_constraint_violation-1163740-134.patch, failed testing.

prezaeis’s picture

So where can i post for help with this issue?

revagomes’s picture

Issue summary:View changes
Status:Needs work» Needs review
StatusFileSize
new909 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,960 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Here goes the patch for D8.

Status:Needs review» Needs work

The last submitted patch, 137: file-Integrity_constraint_violation-1163740-137.patch, failed testing.

Dave Reid’s picture

I don't think time() is a good enough, especially when doing multiple uploads quickly. This would easily collide.

revagomes’s picture

@Dave Reid I'm also concerned about this, but I didn't realized a better way to fix this yet.

In the beginning I tended to make a query to the file_managed table in order to make sure that there isn't already an entry matching with the current uploaded file and update its name if it was already in use but this brings performance issues.

For sure we can go further to find a final solution for this issue. Although I think my proposal will handle this in the most of cases. At this moment I think it's more efficient than what we already have.

What do you suggest? I really appreciate to discuss a better way to fix this.

revagomes’s picture

Status:Needs work» Needs review
StatusFileSize
new2.89 KB
FAILED: [[SimpleTest]]: [MySQL] 59,627 pass(es), 41 fail(s), and 0 exception(s).
[ View ]

Here goes another solution using the uniqid() function to prevent multiple uploads at the same time.

Status:Needs review» Needs work

The last submitted patch, 141: file-Integrity_constraint_violation-1163740-141.patch, failed testing.

YesCT’s picture

Issue summary:View changes
Issue tags:+Needs issue summary update
alexkb’s picture

Happy to try diagnose this for 8.x, but struggling to reproduce the problem based on the some of the comments re: file fields on user entities. Does anyone have some clear instructions to reproduce. Thanks. #drupalsouth

revagomes’s picture

Issue summary:View changes
swaroopa585’s picture

Can any Please give me the ans , Why I am getting the following exception when I am trying to save the Panel in drupal 7.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'panelpage' for key 'name': INSERT INTO {page_manager_pages} (name, task, admin_title, admin_description, path, access, menu, arguments, conf) 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, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => panelpage [:db_insert_placeholder_1] => page [:db_insert_placeholder_2] => panelpage [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => panelpage [:db_insert_placeholder_5] => a:0:{} [:db_insert_placeholder_6] => a:5:{s:4:"type";s:6:"normal";s:5:"title";s:9:"panelpage";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";s:6:"parent";a:4:{s:4:"type";s:4:"none";s:5:"title";s:0:"";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";}} [:db_insert_placeholder_7] => a:0:{} [:db_insert_placeholder_8] => a:1:{s:11:"admin_paths";b:0;} ) in drupal_write_record() (line 7166 of C:\wamp\www\drupal\includes\common.inc).

swaroopa585’s picture

Can any Please give me the ans , Why I am getting the following exception when I am trying to save the Panel in drupal 7.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'panelpage' for key 'name': INSERT INTO {page_manager_pages} (name, task, admin_title, admin_description, path, access, menu, arguments, conf) 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, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => panelpage [:db_insert_placeholder_1] => page [:db_insert_placeholder_2] => panelpage [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => panelpage [:db_insert_placeholder_5] => a:0:{} [:db_insert_placeholder_6] => a:5:{s:4:"type";s:6:"normal";s:5:"title";s:9:"panelpage";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";s:6:"parent";a:4:{s:4:"type";s:4:"none";s:5:"title";s:0:"";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";}} [:db_insert_placeholder_7] => a:0:{} [:db_insert_placeholder_8] => a:1:{s:11:"admin_paths";b:0;} ) in drupal_write_record() (line 7166 of C:\wamp\www\drupal\includes\common.inc).

swaroopa585’s picture

Can any Please give me the ans , Why I am getting the following exception when I am trying to save the Panel in drupal 7.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'panelpage' for key 'name': INSERT INTO {page_manager_pages} (name, task, admin_title, admin_description, path, access, menu, arguments, conf) 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, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => panelpage [:db_insert_placeholder_1] => page [:db_insert_placeholder_2] => panelpage [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => panelpage [:db_insert_placeholder_5] => a:0:{} [:db_insert_placeholder_6] => a:5:{s:4:"type";s:6:"normal";s:5:"title";s:9:"panelpage";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";s:6:"parent";a:4:{s:4:"type";s:4:"none";s:5:"title";s:0:"";s:4:"name";s:10:"navigation";s:6:"weight";s:1:"0";}} [:db_insert_placeholder_7] => a:0:{} [:db_insert_placeholder_8] => a:1:{s:11:"admin_paths";b:0;} ) in drupal_write_record() (line 7166 of C:\wamp\www\drupal\includes\common.inc).

globoandy’s picture

I had the same problem as the title of this issue, in a panopoly installation when going to "Apps". After set chmod 777 to sites/default/files/apps/panopoly_demo , panopoly_faq and panopoly_news it worked fine!

deanflory’s picture

I just got this when attempting to create a test article after deleting some nodes and some files and enabling/disabling some modules:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '22' for key 'vid': UPDATE {node} SET vid=:db_update_placeholder_0 WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 22 [:db_condition_placeholder_0] => 37 ) in node_save() (line 1167 of /.../modules/node/node.module

Modules just enabled:
Comment Easy Reply Node
Twitter Post
LinkedIn
LinkedIn status update
Device Geolocation
Ajax form entity
APC Status

Modules just disabled:
Dummy image
Taxonomy menu
Taxonomy Menu Trails

It turned out to be the Comment Easy Reply Node module. Disabling the Comment Easy Reply Node module brought back functionality for me.

marthinal’s picture

Status:Needs work» Closed (duplicate)
Related issues:+#1556396: Refactor file.inc to make it simpler and prevent PDO exceptions

Duplicated and I think the main thread should be #1556396: Refactor file.inc to make it simpler and prevent PDO exceptions.

asb’s picture

@marthinal : Please consider that this issue is older and more active when changing it's status.

hwasem’s picture

I'm also at a loss. This problem returns with every D7 update and I have to repatch using #108. I'm about to go live with this site, but am concerned due to this problem.

Since this is now closed (?), I will roll back #108 and test with the referenced patch mentioned by @marthinal in #151. But that issue has not been touched in 3 months and it last failed. :( I'm fairly new to Drupal and am really unclear how approval happens. This patch has been working for many and has been ready for over a year. D8 or not, it is holding up D7 sites.

If #151 suggestion works or not - I will report back here. If it doesn't I'll go into more details for @alexkb in #144 above.

Cheers!
Heidi

hwasem’s picture

Just to be sure I started fresh, I went to my dev site and updated to 7.24 -> 7.26. I tested to make sure there was a problem adding a new node without the optional image. Lo and behold - no error! It worked without applying #108 patch.

Looking at the original issue I posted (which later led me here), they mentioned (Followup: tests) file_field_presave assumes that a file object has been loaded which appears to have been included in 7.25. So perhaps this is a solved issue, just by a different issue number - at least it is for me. I thought I'd close the loop just in case anyone was holding off on updates for this issue.

Heidi

ruslana’s picture

I tried to open myPHPAdmin
from operations, repaired the table
and it is back on track

shakthik92’s picture

Guys,

I had the same problem. I solved this by mentioning correct credential in Settings.php file. The problem was i gave wrong username, pwd, host name. So guys, Before u do all research, Plz check whether the given credentials are correct or not.

shakthik92’s picture

StatusFileSize
new24.9 KB

OMG...!!! I think i was wrong... :( Just now i discuss with my frnd....
Integrity Violation : (Duplicate Entry)

Actually I was wrong in my previous comment (may b :P )

<?php
'name' => 'user name',
'mail' => $form_state['values']['mail'],
?>

Here we are giving the ‘name’ column’s value as “user name”. So first time it wont show any error message. But next time if we submit the form, the ‘user’ column’s value will be repeat again as ”user name”. so this error message will come. In Data base we haven’t allowed for DUPLICATE entry for ‘name’ column. That is the problem here. We can resolve this in two ways,
A) Allow the duplicate value for the particular column in database
->Uncheck the PRIMARY KEY
B) Get the run time value for the particular filed (with the existence validation with DB)

<?php
'name' => $form_state['values'][name],
 
'mail' => $form_state['values']['mail'],
?>

I hope this will work :)

marcingy’s picture

@shakthik92 unrelated issue this is to do with the file module and file module alone.

elvin’s picture

#96 solved my problem :)

Ace Cooper’s picture

In my case with the same error neither #137 nor #141 helped.
But a link to the neighbouring topic from #154 fixed my problem.
Thank you, hwasem, for pointing in the right direction.

deanflory’s picture

Anything on this for Drupal 7 as I'm getting this when editing and changing nothing, then saving an Article:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '32' for key 'vid': UPDATE {node} SET vid=:db_update_placeholder_0 WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 32 [:db_condition_placeholder_0] => 61 ) in node_save() (line 1167 of /.../modules/node/node.module).

JoefromLeeds’s picture

#78 worked for me, the issue was with a file upload field as a line item in commerce

harish86’s picture

when i edit user profile and save it then i am get an error.

"Error

The website encountered an unexpected error. Please try again later."

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': UPDATE {users} SET name=:db_update_placeholder_0, pass=:db_update_placeholder_1, mail=:db_update_placeholder_2, theme=:db_update_placeholder_3, signature=:db_update_placeholder_4, signature_format=:db_update_placeholder_5, created=:db_update_placeholder_6, access=:db_update_placeholder_7, login=:db_update_placeholder_8, status=:db_update_placeholder_9, timezone=:db_update_placeholder_10, language=:db_update_placeholder_11, picture=:db_update_placeholder_12, init=:db_update_placeholder_13, data=:db_update_placeholder_14 WHERE (uid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => [:db_update_placeholder_1] => $S$DE6pmKTrt1D58J3YK086khVDhn1inWkKnnOAVy90H4T9etcETVKg [:db_update_placeholder_2] => abc@abc.com [:db_update_placeholder_3] => [:db_update_placeholder_4] => [:db_update_placeholder_5] => filtered_html [:db_update_placeholder_6] => 1409557369 [:db_update_placeholder_7] => 1415427780 [:db_update_placeholder_8] => 1415423112 [:db_update_placeholder_9] => 1 [:db_update_placeholder_10] => Asia/Kolkata [:db_update_placeholder_11] => [:db_update_placeholder_12] => 0 [:db_update_placeholder_13] => abc@abc.com [:db_update_placeholder_14] => a:3:{s:7:"contact";i:1;s:17:"mimemail_textonly";i:0;s:18:"htmlmail_plaintext";i:0;} [:db_condition_placeholder_0] => 50 ) in drupal_write_record() (line 7202 of /var/www/includes/common.inc).

any solution ?.

kenorb’s picture

@harish86: You're posting on already closed issue (again), please raise a new support ticket for that as it seems it's not related to the current issue (different table) or use Drupal SE for asking the questions. If you're using auto_username module, please post on: #2302419: Conflict with user_import, if user_import module, then #2302421: Conflict with auto_username.

The last submitted patch, 137: file-Integrity_constraint_violation-1163740-137.patch, failed testing.

jomarocas’s picture

StatusFileSize
new70.29 KB

i have the error with drupal 7.35 only when a save a new view with block, but the site working good, only this error, i clear cache and make update.php and nothing, how to erase this error and working before this
error

ranjeet1189’s picture

How to solve the issue as

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'rhdhhdhdb@shddh.com' for key 'name': INSERT INTO {users} (uid, name, pass, mail, created, status, init, data) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 795 [:db_insert_placeholder_1] => rhdhhdhdb@shddh.com [:db_insert_placeholder_2] => $S$DQSH6hlxLn8KHQiKzW/ikML8EgNO4i3YwLmWkbB81mAwJoiaq7Lx [:db_insert_placeholder_3] => rhdhhdhdb@shddh.com [:db_insert_placeholder_4] => 1433179882 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => email address [:db_insert_placeholder_7] => a:1:{s:17:"mimemail_textonly";i:0;} ) in drupal_write_record() (line 7207 of

even this email is not present into the table.

i transfer the my local setup to another server and this issue comes.

what will be the issue.
and i want name field to be unique value because it will use for the login purpose.

$success = create_user($_POST); //its working fine.

i have 2 server and its working on first server . and i migrate all files and database to other server and
its site working fine too. but this issue comes .who to overcome ..Please help me ...Thanks .