The system settings page allows the GD toolkit to be selected even if it is not installed. The error is detected when the form is next loaded, rather than when it is submitted. This is a legacy of Drupal 4.6, which did not provide a means to prevent invalid selections from being submitted. In Drupal 4.7 and Drupal 5, the form error prevents any valid settings from being submitted once the GD toolkit option has been submitted.
The attached patch causes validation to be performed before the form is submitted rather than after. It patches both system.module and image.inc. An equivalent patch for Drupal 4.7 is available in issue 102962.
Comment | File | Size | Author |
---|---|---|---|
#35 | image_gd_inc.patch | 5.51 KB | aspilicious |
#33 | 102987-validation-for-gd.patch | 1.79 KB | brianV |
#27 | image.gd_._102987_6.4.patch | 1.46 KB | Bèr Kessels |
#15 | image.gd_102987.patch | 1.84 KB | drewish |
#10 | image.inc_160870.patch | 1.58 KB | drewish |
Comments
Comment #1
Darren OhMissed the patch.
Comment #2
drummpatching file modules/system/system.module
Hunk #1 succeeded at 739 with fuzz 2.
patching file includes/image.inc
Hunk #2 FAILED at 190.
1 out of 2 hunks FAILED -- saving rejects to file includes/image.inc.rej
Comment #3
Darren OhUpdated patch for latest code.
Comment #4
Darren OhIt would be nice to get this committed. Since there was an attempt to commit it once, and the only change was to re-diff for the current code, I'm setting this as ready to be committed. All Image toolkit users will thank you for the privilege of using up-to-date code.
Comment #5
drummTrying to commit the code does not imply that it was reviewed. It is a way of finding code that isn't ready for a review. So there has not been a second reviewer.
This should be added to Drupal 6 first, and then back-ported.
I think this should work with Drupal's status report page; the validation code for that starts at system_requirements() in system.install.
Otherwise, validation code should live next to the form it validates and FALSE should be capitalized.
Comment #6
Darren OhThis should have been taken care of a long time ago. I can't spend my time keeping a patch in sync with all the changes in Drupal. If you prefer keeping Drupal 4.6 FormAPI code in HEAD to committing this patch, go ahead.
Comment #7
drummSorry for your difficulty, but I tried to do my best to provide a valuable review. The blocking issues, which are not Drupal-6-specific, were mentioned in the last paragraph of my review.
Comment #8
Darren OhI'm sorry, but this has been a problem since Drupal 4.7 was released, and I'm not seeing evidence of a commitment to fix it. It was just recently fixed in the 4.7 branch, but it looks destined to re-appear in future versions. Before I consider beautifying the patch, I want a promise that I won't have to fix this again.
Comment #9
Darren OhI have improved the patch as much as I'm going to. Drumm has rejected the patch because it doesn't fix as much as he wants, so I'm removing this from the issue queue.
Comment #10
drewish CreditAttribution: drewish commentedDarren Oh, marked http://drupal.org/node/160870 as a duplicate of this. i'm posting the patch i'd worked out for that. I'd with drumm's goal of a more comprehensive way of checking the requirements but since it's post freeze. I'm just going to submit the smallest set of changes that will fix the bug.
Comment #11
cornfed CreditAttribution: cornfed commentedIs there a patch for the 5.2 version? I'm running into exactly this problem.
Comment #12
drewish CreditAttribution: drewish commentedcornfed, if you're using imagemagick, you might want to try to update to the newest version of the toolkit.
Comment #13
Darren OhThat won't make any difference. It's the GD toolkit that causes the problem. Since it's still using the Drupal 4.6 Forms API, it reports an error before the form is submitted (disable the GD library extension to see for yourself). The error will prevent you from choosing another toolkit if the GD library is missing.
Comment #14
Darren OhBy the way, the hook_requirements() remark in #5 is irrelevant, since we're not dealing with requirements or even a module.
Comment #15
drewish CreditAttribution: drewish commentedlast patch no longer applied. i think this is a little cleaner since it avoids the duplicate call to image_gd_check_settings().
Comment #17
cornfed CreditAttribution: cornfed commentedso, I'm assuming there isn't a 5.2 patch. this is pretty critical for me, my system administrator is pretty insistent on not installing GD toolkit. Although imagemagick shows up as an option, I am unable to select it. any tips are greatly appreciated!
Comment #18
Darren OhThis issue was originally opened to fix Drupal 5. Since the image toolkit code still hasn't changed, the patch in #3 should work for 5.2.
Comment #19
Pasquallecan you provide steps how to test this patch
Comment #20
Darren OhYou need to add a toolkit to the includes directory. At the moment, I only know of the ImageMagick toolkit at
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/image...
You will then have the option to choose your toolkit at admin/settings/image-toolkit. If the page loads without an error, the patch is successful.
Comment #21
Darren OhAlmost forgot: you must disable the PHP GD extension to test this patch.
Comment #22
catchDarren Oh - the patch applies cleanly, and I pulled the toolkit down into my includes directory - was able to select between each one - however I have GD installed - do I have to disable it to test properly?
Comment #23
Darren OhYes, the purpose of the patch is to allow other toolkits to be selected when the GD toolkit is not available. Currently the GD toolkit validation error prevents this.
Comment #24
boydkelly CreditAttribution: boydkelly commentedHi,
I am using Drupal 5.5, and had to switched to a CentoOS 5.0 box that does not have php compiled with GD. I have exactly the problem on this thread. Can the above patch work for me? How do I apply it?
Thanks,
bk
Comment #25
alanburke CreditAttribution: alanburke commentedsubscribe
Comment #26
Bèr Kessels CreditAttribution: Bèr Kessels commented#210469 was marked a duplicate of this issue. It contains some code (for reference?)
Comment #27
Bèr Kessels CreditAttribution: Bèr Kessels commentedRerolled patch against Drupal 6.4 and attached.
Works as advertised. The change in logic is minimal and solves the issue in the IMO correct way.
Comment #28
drewish CreditAttribution: drewish commentedthis never made it into HEAD so i'm bumping the version and kicking the status down.
Comment #29
Darren OhThis is being treated like a feature request. Image handling is likely to be removed from core before this gets fixed.
Comment #30
Bèr Kessels CreditAttribution: Bèr Kessels commentedIt is a bug on 6.x. But not yet on 7, since the imagehandling will be changed and/or removed there afaik.
It is by no means a feature request. One could argue that it is some kind of "wrongly implemented feature that needs improvement", but in my world that counts as a bug too :_)
And also, if this patch gets into 7, then it *still* needs to be applied to 6 as well. (and possibly to 5, but that I cannot confirm).
So, is it not more valid to fix this in 6 and from there see how/if/when to apply this to future releases?
Comment #31
drewish CreditAttribution: drewish commentedCome on Ber, you've been around drupal long enough to know that a bug that's made it from D5 to now isn't going to be magically fixed by a mythical rewrite ;) we need to fix it in Head and then backport.
Comment #32
NukeHavoc CreditAttribution: NukeHavoc commented+1.
The patch works fine for Drupal 5.14; I haven't tried the Drupal 6 version. It'd be nice to get this bug fix into both 5 and 6, seeing as how it prevents the use of any image kit other than GD. Usually it's not a big deal, as most places do support GD, but it was a headache when I was trying to get Drupal working with ImageMagick working on my Mac's test environment.
Comment #33
brianV CreditAttribution: brianV commentedD7 patch!
Comment #35
aspilicious CreditAttribution: aspilicious commentedI rerolled...
This patch isn't rdy yet it needs more documentation but I don't have the knowledge to write it :).
I also fixed a dozen doc style problems in the file.
Comment #36
aspilicious CreditAttribution: aspilicious commentedComment #37
retester2010 CreditAttribution: retester2010 commented#35: image_gd_inc.patch queued for re-testing.