D6 Problem on multilingual sites (interaction with i18nsync)
| Project: | Upload path |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
When using uploadpath set to [nid]/[yyyy]-[mm] and in combination of a multilingual Drupal setup I can upload a file to a node but when I want to provide a translation of this node (hence creating a new node containing the translation) I can upload a file but I invariably get the following PHP error:
Fatal error: Cannot use object of type stdClass as array in C:\xampp\htdocs\sites\all\modules\uploadpath\uploadpath.module on line 36
This appears to be within uploadpath_nodeapi().
When looking in the error logs I eventually stumble across a duplicate warning in another module:
Duplicate entry '9-3' for key 1 query: INSERT INTO upload (fid, nid, vid, list, description, weight) VALUES (3, 7, 9, 1, 'dummyfilename_fr.pdf', 0) in C:\xampp\htdocs\sites\all\modules\i18n\i18nsync\i18nsync.module on line 128.
This in turn points to i18nsync_nodeapi() in the i18nsync module (which is part of i18n).
As I understand this, the uploadpath module tries to link the attachment to the same file identifier (fid = 3) which the database scheme apparently does not allow.
In the "Synchronize translations" options in the "Workflow" settings of the Page content type I did not tick "attachments". I am not sure which module is the culprit.
Could somebody shed some light on this issue and help in finding a fix?.
Thanks in advance!
Olivier

#1
This issue may be also that sometimes Drupal treats $node->files as an array of arrays and sometimes as an array of objects, the nodeapi hook may need to account for both possibilities, perhaps due to this type of module interaction.
It may also help to set the module weight in the system table so that one module processes before the other but at the moment, it may require a code update along the lines of
if( is_object($file) ){ ... } elseif( is_array($file) ){ ... }DT
#2
Thank you for this clarification.
I infer from your post that it may be even a Drupal core
nodeapiproblem?Since this problem appears in combination with the i18n module I also added this issue to the i18n queue as #363065: D6 Problem integrating i18n and upload_path (file uploads in translated nodes) (and providing a link from there to this link).
#3
This should be fixed now, I think it was the same or related issue as #363065: D6 Problem integrating i18n and upload_path (file uploads in translated nodes)