clean up form data in submit handler, not hook_nodeapi -- produces PHP Fatal Error with Node_Import
sphopkins - September 27, 2009 - 18:52
| Project: | Image |
| Version: | 6.x-1.0-beta3 |
| Component: | image_attach |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Description
Please see my description here #589422: PHP fatal error
I think that a change in Image.Module has impacted another module

#1
#2
It helps if you repeat the problem here:
Can you confirm your line 343 is this:
// Unsetting the "- None -" entry from the form select entriesunset($node->iids[0]);
If so, I'm sure there are better places for this than hook_nodeapi -- it's dealing with a quirk of the form, whereas hook_nodeapi is meant to be general. We should move it to a submit handler perhaps?
On the other hand, apparently
"PHP 5 seems to have an error where it tries to treat strings as arrays instead of highlighting the error"
did you run update.php after upgrading to the latest image module?
#3
I will confirm tomorrow when I have full access to my server. However as I have not touched anything I am sure it is whatever you guys released ;-)
I did run update.php but I will verify that it has been completely done...
#4
Confirmed:
// Unsetting the "- None -" entry from the form select entriesunset($node->iids[0]);
As well I have confirmed that update.php was run, and I reran it to verify.
Hope this helps.
#5
Does commenting out that line fix the problem?
#6
I will test that. I am not normally comfortable changing some of the code without someone who knows what is happening giving me the go-ahead !
#7
Commenting the line out worked to allow the Node_import to work properly.
Thanks for reviewing.
#8
Thanks for confirming.
Better title.
#9
Please could you test this patch?
You'll need either a clean copy of beta3 or the dev release to apply it to.
This patch also needs to be tested for regular use of image attach: creating and editing nodes normally, without node_import.
#10
I will look at this patch. I only have a production server so I am leery of messing it up ;-)
#11
The drupal docs have a section on running a test server locally. This is a good idea to have in general, and is a lot easier to set up than it used to be: basically, xampp on Windows and mamp on a mac.
#12
Yeah I have MAMP Pro and I did use it for testing to get the website up and running but it has gone stale since I implemented the site. I will try and update things to the same level before testing.
#13
I recommend this for cloning your live site to your dev server: http://drupal.org/project/backup_migrate -- does it in about three clicks; an absolute breeze.
#14
Subscribing
#15
Hi I've tested the above patch on a production server and it seems not to fix the issue.
before
Tue Oct 20 14:09:37 2009] [error] [client 192.168.1.1] PHP Fatal error: Cannot unset string offsets in foobar/drupal-6.14/sites/all/modules/image/contrib/image_attach/image_attach.module on line 343
after
[Tue Oct 20 14:55:09 2009] [error] [client 192.168.1.1] PHP Fatal error: Cannot unset string offsets in foobar/drupal-6.14/sites/all/modules/image/contrib/image_attach/image_attach.module on line 332
So I'm left with a commented out version which does work.
#16
Gah, what is node_import doing???
If it's triggering the form submit handler, then surely it's using the form in some way and so the values should be there.
What version of node_import are you using?
And could you post a sample node that causes this problem so I can try the import myself?