- First commit to issue fork.
--
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:
Closed: duplicate
8.0 ⚰️
After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.