Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
SelectQueryExtender->hasAllTags method uses syntax not accessible to PHP 5.2.x installations, which violates
Drupal 7 base requirement for PHP version. Simple change fixes the problem. Patch attached.
Comment | File | Size | Author |
---|---|---|---|
#11 | 1411592-func-get-args-as-parameter.patch | 2.41 KB | Niklas Fiekas |
#1 | select.patch | 478 bytes | dadikof |
select.patch | 546 bytes | dadikof | |
Comments
Comment #1
dadikof CreditAttribution: dadikof commentedGenerated patch used filesystem absolute paths, updated. No experience with Drupal patches, sorry :)
Comment #2
aspilicious CreditAttribution: aspilicious commentedComment #4
aspilicious CreditAttribution: aspilicious commentedSee http://drupal.org/node/707484 and have fun :)
Comment #5
aspilicious CreditAttribution: aspilicious commentedBtw this is not critical...
Comment #6
chx CreditAttribution: chx commentedThe patch is good but needs tests.
Comment #7
xjmAlso, let's create a D8 version. Thanks!
Comment #8
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedWe already have test coverage:
Only, we didn't notice because the testbots run PHP > 5.3.
Obviously there is more usage of func_get_args(). Not so obviously, but also not surprising: Some more wrong usage.
./includes/form.inc: $args = func_get_args();
./includes/form.inc: $args = func_get_args();
./includes/cache.inc: if (func_get_args()) {
./includes/bootstrap.inc: return drupal_array_merge_deep_array(func_get_args());
./includes/bootstrap.inc: $args = func_get_args();
./includes/module.inc: $args = func_get_args();
./includes/module.inc: $args = func_get_args();
./includes/file.inc: $args = func_get_args();
./includes/database/select.inc: return call_user_func_array(array($this->query, 'hasAllTags'), func_get_args());
./includes/database/select.inc: return call_user_func_array(array($this->query, 'hasAnyTags'), func_get_args());
./includes/database/select.inc: return !(boolean)array_diff(func_get_args(), array_keys($this->alterTags));
./includes/database/select.inc: return (boolean)array_intersect(func_get_args(), array_keys($this->alterTags));
./includes/database/schema.inc: $args = func_get_args();
./includes/database/sqlite/database.inc: $args = func_get_args();
./includes/database/sqlite/database.inc: $args = func_get_args();
./modules/system/system.tar.inc: $v_att_list = &func_get_args();
./modules/simpletest/tests/database_test.test: $modules = func_get_args();
./modules/simpletest/tests/ajax.test: $modules = func_get_args();
./modules/simpletest/tests/test.php: call_user_func_array('dump', func_get_args());
./modules/simpletest/tests/menu.test: $modules = func_get_args();
./modules/simpletest/tests/menu.test: $modules = func_get_args();
./modules/simpletest/tests/menu.test: $modules = func_get_args();
./modules/simpletest/drupal_web_test_case.php: $modules = func_get_args();
./modules/field/tests/field.test: $modules = func_get_args();
./modules/field/tests/field.test: $modules = func_get_args();
./modules/field/tests/field_test.field.inc: $args = func_get_args();
./modules/field/tests/field_test.field.inc: $args = func_get_args();
./modules/field/tests/field_test.field.inc: $args = func_get_args();
./modules/field/tests/field_test.field.inc: $args = func_get_args();
./modules/field/tests/field_test.field.inc: $args = func_get_args();
./modules/field/tests/field_test.module: $args = func_get_args();
./modules/field_ui/field_ui.test: $modules = func_get_args();
./modules/field_ui/field_ui.module: $args = array_slice(func_get_args(), 4);
./modules/image/image.module: $args = func_get_args();
./modules/file/file.module: $form_parents = func_get_args();
./modules/file/tests/file.test: $modules = func_get_args();
This sucks. Should we really fix that for D8? What PHP version will it require?
Comment #9
xjm@Niklas Fiekas pointed out that this is specific to PHP 5.2 only, so a D8 patch may not make sense. Doh! Sorry about that. Whether we change the syntax in D7 only or in both branches for all this? Tough call.
jthorson pointed out it's not technically feasible to test patches on PHP 5.2 at present, either, so tough to sort out what to do about testing.
Comment #10
webchickI think it's fine to fix these for D7 as long as the fixes are also PHP 5.3 compatible. No reason to do this in D8 though, unless Crell really wants to keep the code bases in sync.
Comment #11
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThe attached patch converts all occurences of a wrong func_get_args(). Setting to a more general title. Let's see what the testbot says, but this shouldn't break anything.
To verify that it actually fixes the problem, we need manual testing, as jthorson pointed out. Running the core testsuite on a PHP 5.2 machine should be sufficient but painful.
Comment #12
droplet CreditAttribution: droplet commentedLooks good. PHP 5.2 and below don't support Closure.
Is there any plan / ref about how to use closure/anonymous function in D8 ? (http://php.net/manual/en/functions.anonymous.php)
Comment #13
chx CreditAttribution: chx commentedWhile #12 looks a bit off topic to me, http://php.net/manual/en/function.func-get-args.php indeed says
So the patch is good / unnecessary for D8.
Comment #14
webchickThanks folks! Committed and pushed to 7.x.