Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently get_extension_funcs is not supported in HHVM. It is only used in image_gd_check_settings(). Will create a patch to use function_exists instead of get_extension_funcs.
Comment | File | Size | Author |
---|---|---|---|
#18 | drupal-2161955-18-gd-remove-get_extension_func-D7.patch | 617 bytes | mikeytown2 |
#13 | gd-2161955.patch | 1.61 KB | dawehner |
#10 | 2161955-remove-get_extension_func-10.patch | 1.54 KB | wiifm |
#1 | drupal-2161955-1-dont-use-get_extension_funcs.patch | 629 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
Garrett Albright CreditAttribution: Garrett Albright commentedHuh. What benefit does using get_extension_funcs() have over simply function_exists() in the first place? Aside from HHVM compatibility (discussion thread here), it seems like far more straightforward code.
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedI'll go ahead and RTBC this as it cleans up the code making core more readable.
Comment #4
slashrsm CreditAttribution: slashrsm commented+1 to commit that
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedSide note via gotta_download_them_all; these are the module that use get_extension_funcs()
grep -l -r -i "get_extension_funcs(" ./
https://drupal.org/project/acidfree (D6)
https://drupal.org/project/dragdrop_gallery (unpublished due to SA)
https://drupal.org/project/dcco (core is inside so this is a non issue)
So core it the only place that needs the fix from what I can see. Also noted that I had to fix one of my modules in order to be HHVM compatible #2162025: Warning: Invalid argument supplied for foreach() in httprl_send_request() line 1528 of httprl.module.
Comment #6
dawehnerjust don't do that.
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedI find that I need to put things to RTBC for smaller simpler patches in order to get guidance on it a lot of times. This patch waited over a year before it was tagged as a duplicate #1633130: Path admin/structure/menu/parents returns 403 unless UID=1.
Patches that are small usually don't require much review as well #1937860: seven_css_alter does not set the type. I got a this looks good from #2 so I moved it to RTBC.
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedSeems reasonable (git blame for this goes all the way back to #18700: image.gd.inc isn't compatible with gd 1 which doesn't seem to have a clear reason for not using function_exists())...
But this code is in Drupal 8 too. (And there's a second call to get_extension_funcs() there also.)
Comment #9
wiifmRe-rolled against D8 HEAD, using the same syntax as in #1.
Comment #10
wiifmSpotted an awkward double space in the code, new patch with correct spacing attached.
Comment #12
wiifmheh, one patch passed an the other failed. Both are functionally equivalent. Test bot sad face. Can anyone RTBC this?
Comment #13
dawehnerCan't we just do the following?
Comment #14
slashrsm CreditAttribution: slashrsm commentedThis is definitely the cleanest one. RTBC if green.
Does anyone have idea why get_extension_funcs() was used in the first place?
Comment #15
slashrsm CreditAttribution: slashrsm commentedComment #16
mikeytown2 CreditAttribution: mikeytown2 commented#13 Looks good. +1 for RTBC
Comment #17
webchickNice!
Committed and pushed to 8.x. Thanks!
Marking back to 7.x.
Comment #18
mikeytown2 CreditAttribution: mikeytown2 commentedComment #19
mikeytown2 CreditAttribution: mikeytown2 commentedPatch passes tests. +1 from me for RTBC.
Comment #20
mimes CreditAttribution: mimes commentedPatch in #18 complies with Drupal coding standards and appears to fix the stated bug.
It's worth noting that there's an issue recommending the depreciation of
function_exists()
foris_callable()
for Drupal 8 and another here, but it's probably too late to do so now.Comment #21
BerdirThat's not really relevant here, as we're checking an actual, hardcoded function.
Comment #22
BerdirCreated meta issue for HHVM: #2165377: [meta] HHVM compatibility
Comment #23
fietserwin#14:
There was a discussion in #1069140: Requirements should be provided by image toolkit, comments #40 to #42. I obviously (as can be deducted from those comments) agree with not using get_extension_funcs().
Comment #25
mikeytown2 CreditAttribution: mikeytown2 commented18: drupal-2161955-18-gd-remove-get_extension_func-D7.patch queued for re-testing.
Test went fatal on something unrelated; retesting.
Comment #26
fietserwinTests succeeded.
Comment #28
mikeytown2 CreditAttribution: mikeytown2 commented18: drupal-2161955-18-gd-remove-get_extension_func-D7.patch queued for re-testing.
Test went fatal due to several missing tables.
Comment #29
fietserwinTests succeeded.
Comment #30
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks!
And thanks for the explanation of why get_extension_funcs() might have been used originally. I agree that better support for HHVM is more important than the edge case where someone defined imagegd2() without the intention of it replacing the one from the GD library (that is really not something anyone should be doing anyway).