I have a views page with a path like admin/content/xxx after having enabled admin_views when I try to display it I have this php error :
Fatal error: require_once() [function.require]: Failed opening required '/sites/drupal7//node.admin.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /sites/drupal7/includes/menu.inc on line 514
The drupal message is :
Warning: require_once(/sites/drupal7//node.admin.inc) [function.require-once]: failed to open stream: No such file or directory in menu_execute_active_handler() (line 514 of /sites/drupal7/includes/menu.inc).
I can get my page back if I change the path to admin/content/xxx/yyy I think this is because I don't go into this condition :
if (isset($callbacks[$path]) && ($num_parent_parts + 1 == $num_child_parts))
in views_plugin_display_system.inc
In last dev this is :
if ($num_parent_parts == $num_child_parts - 1) {
| Comment | File | Size | Author |
|---|---|---|---|
| #66 | child-menu-items.txt | 7.79 KB | acbramley |
| #51 | 1673830-51.patch | 5.29 KB | damiankloip |
| #48 | 1673830-48.patch | 5.28 KB | damiankloip |
| #42 | 1673820-40.patch | 5.4 KB | damiankloip |
| #38 | 1673820-38.patch | 5.4 KB | damiankloip |
Comments
Comment #1
sunSo you're saying that your view on admin/content/xxx is NOT a view that uses the system display handler?
So, hrm, possibly yes... that code does not seem to check whether the $child[_path] actually 1) is a view and 2) is a view using the system display handler.
OTOH, we always need to inherit, since e.g. the case of the admin/content view, any router item properties of the admin/content view would be inherited to any + all child router items.
In any case, we should be able to reproduce this bug in a simple test. Let's do that first. :)
Comment #2
damiankloip commentedHow about something like this to get the ball rolling? Just creating a default view at admin/content/test and checking for the title text in the response? It should currently fail as nothing is returned.
Comment #4
damiankloip commentedSorry, had the default view in the wrong place. Created a setUp method for in on the plugin test class.
Comment #6
damiankloip commentedDid I put the stuff in the setUp the wrong way round?! One of those days ....
Comment #8
damiankloip commentedThat's what I was after, 1 failing test!
Comment #9
alexweber commentedI was about to say dude, they whole point of this patch is for the test to fail! :P
@sun, we have the failing test now :)
Comment #10
damiankloip commented@alexweber, yes, the first 2 patches were truly broken though! Hence elation with the last failing test, which is correct :)
Comment #11
damiankloip commentedHere is test with a proposed fix, to check whether the child page callback is a 'views_page'. Should work?!
Comment #13
damiankloip commentedHm, that passes locally..
Comment #14
damiankloip commented#11: 1673820-11.patch queued for re-testing.
Comment #16
alexweber commented@damiankloip, this may sound silly but is this against dev? I'd love to help out if I get a chance later on today...
Comment #17
damiankloip commented@alexweber, yep, this is against the 7.x-1.x repo, same as my local.
Comment #18
alexweber commented@damiankloip, I've reviewed the patch and have 2 comments at the moment:
1 - It throws a notice in strict mode:
2 - Some tests still don't pass:
I'm gonna take a few to look into it and I'll post back if I find anything!
Comment #19
alexweber commentedUpdate: The patch from #11 fixes this specific issue but breaks links under "admin/people", specifically the "admin/people/create" link. That's what was causing the failed test. Moreover, the test added by the patch was thrown into another existing test, which isn't ideal.
Attached is a patch that refactors that approach and creates a new test which, as expected, fails because page views created in the admin/content/xxx path are most certainly broken.
Comment #20
alexweber commentedOk, this should now work perfectly!
Comment #22
alexweber commentedsilly testbot, don't make me slap you
Comment #23
damiankloip commented#20: admin_views-1673820-20-final-fix-bug-and-pass-test.patch queued for re-testing.
Comment #24
damiankloip commented@alexweber, good work!
I have changed a few comments, removed the cache and menu rebuild stuff too, as the view wont be previously loaded so there is no real reason to clear the static cache (I don't think). Also, menu_rebuild() will be invoked when the view is saved anyway.
So... Hopefully, this version should be good!
Comment #26
damiankloip commentedHmm, that's annoying. Maybe the menu_needs_rebuild being set isn't enough....
Comment #27
damiankloip commentedoh dear.....
Comment #29
damiankloip commentedJust trying something else ....
Comment #31
damiankloip commentedOh, ok. So we do need both? I'm not entirely sure why, but give testbot what he wants :)
Sorry for doubting the menu stuff to start with! :)
Comment #32
alexweber commented@damiankloip, no problem. The test bot was on crack or something cause now the patch from #20 passed too :)
Either way, a maintainer should probably take a look at these and hopefully commit the fix!
Comment #33
damiankloip commented@alexweber, that would be me then ;) I would like it if @sun could take a look too though, before I commit this one. So maybe we will leave it for a bit...
Comment #34
alexweber commented@damiankloip oops :)
It never ocurred to me to look at the project page I just assumed you were some random guy like me trying to get this to work :)
Comment #35
sun1) Can we improve and clarify the comment to state more clearly what special condition we're trying to account for? If/however/then/else... Especially the parent/child relationship and types of router items being targeted (a view) is not really clear. The @see (bogus @link) should not be necessary.
2) I wonder whether 'file' is really the only property that produces problems? Is it possible that we might have to change the primary condition for adjusting the children in this loop, instead of trying to fix up a particular unintended consequence of performing the adjustments in the first place?
Can we expand and clarify the comments for this test a bit? It's not really clear right now what exact scenario is being tested (unless you know of this issue).
Comment #36
alexweber commentedThanks for the feedback sun.
As far as your comment regarding "file", I did test this extensively and it's pretty much the only key that breaks things. I do agree, however, that it's more elegant to avoid the problem happening than fixing it later.
I'll get on this later on today when I have some time. That is, if damiankloip doesn't beat me to it first :)
Comment #37
damiankloip commented@alexweber, I am having a quick look at this now. I don't have too much time though. So if you see nothing on here later, jump in! The original patch attempted to move this logic before the child item is modified I think?
Comment #38
damiankloip commentedWorth a go.
Comment #39
damiankloip commentedunfortunate about the whitespace :)
Comment #41
damiankloip commentedHeh, that still breaks. Ran out of time now...
Comment #42
damiankloip commentedComment #44
alexweber commentedThis is proving to be a herculean effort for such a small issue... :)
Props for persistence, lol, I'm not giving up either, I just won't be able to check this out for another 8 hours, I'm at work atm.
Comment #45
damiankloip commentedThe last effort admittedly were quick and slightly lazy :), when I have more time. As before, please jump in later if you feel up to it.
Comment #46
sunThe test failure is being caused, because the new condition checks for a page callback being set, but children do not necessarily have a page callback.
I think we want to leave the initial condition alone, and rather add a second inner condition; e.g.:
Comment #47
damiankloip commented@sun ha, that's pretty much what I had in my first patch after the test :) its always nice to go around the houses though...ill fix this up shortly when om home.
Comment #48
damiankloip commentedHow about this?
Comment #49
damiankloip commentedComment #51
damiankloip commentedSchoolboy error! what is wrong with me today....
Comment #52
damiankloip commented@sun, happy for me to put this in?
Comment #53
alexweber commentedPretty please :)
And IMHO this alone warrants a new version... I've had to disable this module on quite a few websites because of this bug... I'm sure I'm not the only one!
Comment #54
sunLooks good, thanks! :)
Comment #55
damiankloip commentedAwesome, committed. Thanks @alexweber & @sun!
@sun there are a couple of other patches I would like to get in before a release, but I think this was the last bug blocker. What do you think? Can we just straight to an rc? Is that too bold? :) It will get more people using it think. You know how people get scared of alpha/beta releases, plus we have done quite alot of testing and patches since the last release.
Comment #56
alexweber commentedThanks @damiankloip and @sun! :)
Comment #57
tripper54 commentedbig thanks for the work on this - has solved a huge headache for me
Comment #58
danepowell commentedI'm not sure that this has been totally fixed. I just downloaded admin_views-7.x-1.0-alpha1+22-dev and the Relation module, which uses the path $base_url/admin/content/relation, and I'm seeing the same error described by OP.
This was originally posted in the Relation queue: #1739332: Contrib module admin_views breaks relation tab
Comment #59
acbramley commentedGot this issue too with admin_views alpha 1, this wasn't a views page but a custom module menu item under admin/content/bulk-upload. Have upgraded to 7.x-1.x but the issue still remains, bumping issue priority
Comment #60
alexweber commented@acbramley thanks for clearing this up. The committed patch was specific to views pages so I guess we need to account for custom paths too...
Comment #61
acbramley commentedEven more so, I've lost access to admin/content and admin/people after upgrading to --dev. I was really looking forward to using this module but can't now :(
Comment #62
damiankloip commentedYou can always try to help resolve the issue....
Comment #63
acbramley commentedI was going to start looking into it today, what's the reason behind the code that changes all children menu items to use the same properties as the views menu item with the system display?
Comment #64
damiankloip commentedThis seems to be working ok for me, do you have your hook_menu implementation?
(Needs work is a patch needing work)
Comment #65
acbramley commentedOk, a bit more detail:
* After enabling admin_views, I saving a view with a system path of admin/content and dumped out $child directly under the line $child = &$callbacks[$child_path]; (line 166 of views_plugin_display_system.inc), please find the child dumps in the attached file below.
* I now get access denied on admin/content, and errors like this on sub pages (this example is on the custom page defined in a custom module tpow_bulk_upload:
Comment #66
acbramley commentedChild menu items
Comment #67
damiankloip commentedCan you provide some sample code so I can re create your implementation of hook_menu etc.. here locally? If/when I can re create this I will try and get a fix done today.
Are you just using the unchanged/stock default views too?
Comment #68
acbramley commentedOk, so my custom module is called tpow_bulk_upload. Here's the hook_menu:
For the page callback you could just use:
The views I am using are cloned versions of admin_content_node and admin_user_user from the alpha 1 version of admin views. I will try to replicate this on a fresh drupal install
Comment #69
acbramley commentedReplicated the error:
Fatal error: require_once(): Failed opening required '.../sites/all/modules/custom/tpow_bulk_upload/node.admin.inc'
Installed my custom module and 7.x-1.x admin_views on a fresh drupal install (obviously along with views, entity, vbo, and ctools), went to admin/content/bulk-upload and got the error.
Comment #70
alexweber commentedThat'll happen, we always blindly inherit the "file" array key from the parent menu item; in this case "admin/content" (which lists nodes and requires node.inc). If im not mistaken that patch above was specfic to views implementations but im guessing this can also happen with custom hook_menu()s and possibly with page manager too.
Comment #71
sinasalek commentedUpdating to the latest dev fixed my problem. tx
Comment #72
damiankloip commented@alexweber, yes you are right. I'm not entirely sure of the best way to approach this reliably for all cases. I would guess if you added a 'file' key to your hook_menu item (just specifying even the .module file of your module) it would work ok?
Comment #73
alexweber commented@damiankloip Yeah I think that would work!
Comment #74
damiankloip commentedI'm not sure we can fix this tbh, we don't really have a way of knowing if the child is meant to inherit the file property from it's parent or not. So I think the solution would have to be that it needs to be explicitly set if you have any child menu items?
Closing as 'won't fix' for this. @sun, please reopen if you disagree.
Comment #75
jdrefahl commentedI ran into this error as well, but it was dealing with admin/structure/blocks wasn't showing (500 Error). First thing I did was try and clear the cache, and this was unsuccessful. I then went into the command line, and tried clearing the cache using Drush. Drush returned this error to me:
I searched based on this error and came to this post you are reading now. When I saw that the error had something to do with Views working on Content I remembered that i had recently installed and then uninstalled the Administrator Views module.
I reinstalled the module, enabled, and tested to see if admin/structure/blocks would render, and it did! I then went back and disabled the module and everything was fixed. I figured that somewhere along the way there was a DB corruption that happened during the uninstall of the module. By simple reinstalling and then uninstalling the module again it seemed to have cleaned up whatever mess that was causing Drupal to throw the 500.
Comment #76
aschiwi commentedIt was admin_views causing this for me as well, thank you jdrefahl.
Comment #77
ressaI got this after uninstalling the module, after the security team marked this project unsupported tonight in SA-CONTRIB-2019-076. I got a white page after clearing the cache and after
drush cc all:Reinstalling and uninstalling the module fixed it.