Closed (fixed)
Project:
Module Filter
Version:
8.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
2 Mar 2017 at 20:36 UTC
Updated:
24 Oct 2017 at 12:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joelpittetComment #3
greenskin commentedWhat is the notice being thrown, and what version of Drupal are you running? I'm not able to reproduce the issue. Also, what version of PHP?
I'd really rather not split up into separate loops for a couple different reasons. You would essentially be looping over the exact same array twice unnecessarily, and adding another array to memory (oh, and more lines of code). The more modules in the list, the more that extra loop and array costs. Looking at the submitted patch, I'm not seeing how the extra loop would really make any difference. It's essentially doing the same thing as the single loop except with the additional array to memory and going through the loop a second time.
Comment #4
greenskin commentedActually, as I've been looking more at the patch, I see the second loop is missing it's outer loop on packages. So that loop's
$moduleis actually the package name and$detailsis the array of modules in that package.Comment #5
joelpittetVersion of PHP is 5.6, but should show those notices if you have the error level turned up/E_ALL.
You may be able to do it in one loop but being nested as it is with packages in the form and by modules in the form state values means it will be a pain and less clear. Feel free to try though.
Comment #6
greenskin commentedIf it's a matter of clarity versus performance and efficiency, adding a comment will be sufficient to clarify here. I'd also suspect if the original code is giving you notices then a fixed version of your patch (see comment #4) will also (though I can't be sure without knowing the notice message) given it's essentially identical except with building a defaults array rather than checking the source directly. When looping over the form state it's first on packages then on modules, so nested loops is necessary. The patch would do this nested loop twice, so if it's a pain and less clear then it's doubled down by needing to do it twice.
Yep, my error level is configured to E_ALL, however I'm running PHP 7.0 so I don't know if that's making the difference. Can you copy and paste in one of the notices, and what is the version of Drupal you are running? I've tested with the latest stable release 8.2.7.
Comment #7
joelpittetI'm using 8.4.x branch, just tested it out in 8.3.x branch of core and it's the same. Here's the error message when enabling a new module, there is one of these notices (with xdebug stack trace) for every module on the page.
I'll leave it to you to clearly rewrite the code I wrote into one loop as you seem know how to do that.
Comment #8
joelpittetI can't reproduce it in 8.2.x so this is really just a bug in
> 8.3.x, sorry didn't think that array structure would have changed between versions. I'll try to track down the patch that made this change in core.Comment #9
joelpittetHere's a couple screenshots you can see the structure of
$form_state->getValue('modules')has changed.Comment #10
greenskin commentedAh, okay. That then makes sense why I wasn't seeing it. I'll see what I can do which will work with the current stable Drupal release and the 8.3.x branch. Thanks joelpittet!
Comment #11
kingdutchRelated change notice is here: https://www.drupal.org/node/2851653
This makes the module filter module unusable on 8.3.0 and up because enabling modules is now impossible.
Comment #12
kingdutchApplied the patch and went to the modules page. Filtered on the migrate module and selected it to enable. After submitting the form the module was not enabled.
Comment #13
joelpittet@Kingdutch, that sounds unrelated this issue is about "Recently Enabled" notices, it's much less important than what you are mentioning but likely related tangentially.
Comment #14
jaydee1818 commentedI'm having the same issue:
Drupal 8.3.2
PHP 7.0.14
Comment #15
smustgrave commentedI'm using Drupal 8.3.3 and PHP 5.5.38. I was also seeing the notice. I just started looking into Drupal 8 so apologizes.
Comment #16
greenskin commentedThis patch should fix the issue and remains backward compatible with Drupal 8 versions prior to 8.3.0.
Comment #17
joelpittetThat seems to avoid errors, but currently the filtering doesn't seem to be working, so can't RTBC this quite yet to test it properly.
Comment #18
OnkelTem commentedYes, I confirm that while warnings disappear after applying #16 modules can not be installed if you locate a module using the filter.
What I mean is:
1) If I type e.g. "SEO" and the list is filtered to present a list of matching modules, and there I tick a module and press the Install button, it doesn't get installed.
2) If I don't type anything in the filter and scroll to the same module, then tick it and press the Install button, it does get installed.
I set it to major because it's the primary function of the module: to filter and install.
Comment #19
apratt commentedSeeing the same behaviour with drupal 8.3.5 on PHP 7.1
Comment #20
mengi commentedConfirm on drupal 8.3.7 and php 5.6. Just like #18 says, searching for a module doesn't allow it to be enabled.
Comment #21
ccjjmartin commentedUpdating status based on the last 4 comments to "needs work".
Comment #22
greenskin commentedI just tested with a fresh download of Drupal version 8.3.7, running PHP 5.6.31. The only non-core modules included were devel and module_filter. I have not been able to replicate the issue of a module not installing when the list is filtered. I've even tried filtering, checking a module to enable, changed the filter so that module is hidden, and submit. The module installs successfully.
The changes provided by the patch run whether the list is filtered or not (the filtering is purely JavaScript and affects nothing server side). Try clearing cache and if the problem persists please open a separate ticket.
Comment #23
websiteworkspace commentedWhat is the projected date for the fix for this problem to be integrated and released as a new version?
Comment #24
mengi commentedI tried with fresh install, #16 works fine. No warnings and I am able to filter and enable a module.
Comment #25
joelpittetSame
Comment #27
alphawebgrouplooks like it's fixed now