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.
Humbly hoping that Drupal 7 will eventually support PHP 7.2, I will be making issues for possible incompatibilities.
create_function()
is deprecated in PHP 7.2. Fortunately for us, there is only one create_function() call in whole D7 core.
I will attach a patch for your review. The only call is used as a callback function for one array_map()
call. I have moved it to a standard function. This pattern was also followed in the same file.
Comment | File | Size | Author |
---|---|---|---|
#4 | drupal_7_php_72_create_function_deprecation-2885129-4.patch | 1.06 KB | Ayesh |
Comments
Comment #2
Ayesh CreditAttribution: Ayesh as a volunteer commentedComment #4
Ayesh CreditAttribution: Ayesh as a volunteer commentedComment #5
Ayesh CreditAttribution: Ayesh as a volunteer commentedComment #6
Ayesh CreditAttribution: Ayesh as a volunteer commentedComment #7
MustangGB CreditAttribution: MustangGB commentedWhy not just use an anonymous function?
e.g.
Comment #8
Ayesh CreditAttribution: Ayesh as a volunteer commentedThanks for your reply. Yes, that would have been great!
Unfortunately minimum PHP requirement for 7.x is PHP 5.2, but anonymous functions are only available since PHP 5.3.
Comment #9
mithenks CreditAttribution: mithenks at bmeme commentedComment #10
apadernoThis is pretty straight.
Comment #11
bkosborneAgreed. Also note that this code will never be executed anyway, unless someone is running a version of Drupal 7 from 2010 (that's when the db update hook was written).
Comment #12
oadaeh CreditAttribution: oadaeh at Hook 42 commented@bkosborne don't assume that won't happen. Not everyone updates their site.
Comment #13
bkosbornethen they wouldn't need to worry about update hooks anyway ;)
Comment #14
Fabianx CreditAttribution: Fabianx as a volunteer commentedAgree with RTBC, this is pending commit.
Comment #15
Fabianx CreditAttribution: Fabianx as a volunteer commentedCommitted and pushed to 7.x. Thanks all!
Comment #18
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThis should run for anyone updating from Drupal 6 to Drupal 7 also.
In any case, patch looks good!