Closed (fixed)
Project:
Node Access
Version:
6.x-1.6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
26 Mar 2009 at 19:20 UTC
Updated:
3 Jan 2014 at 00:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
emptyvoid commentedThis may be because of the funny code I had to include into the module to be compliant with the drupal.org admins.. I will look into this error and try to reproduce it. Once I figure it out I will post the solution and commit the change.
Thanks for submitting the bug.
Comment #2
emptyvoid commentedI can not reproduce your bug,
It would appear you have pear installed, I don't have a development environment that uses the pear packages and Drupal at the same time. Also how is your php base directory being defined? The code in question where this bug appears dynamically identifies the path to the root of the Drupal installation based on the URL path and php base. If your php server base path is not correctly defined it can cause the paths to get confused.
For example at the top of my drupal index.php file I enter:
if ($_SERVER["HTTP_HOST"] != "localhost") {
ini_set("include_path","e:\hosting\member\emptyvoid");
}
Where the path is the root to my website (that is the physical path as provided by your hosting provider). This forces php to properly identify the path to the root of the application.
If you can accomplish this and the bug remains please let me know if the error is different.
Comment #3
emptyvoid commentedassigning to myself for record keeping..
Comment #4
emptyvoid commentedPlease provide the following information
Operating System:
Operating System Version:
Database Server:
Database Server Version:
Http Server:
Http Server Version:
PHP Version:
Also please provide a link path to where the error occurred: (it doesn't matter that I can't access your site it helps me identify where)
Comment #5
emptyvoid commentedThe nature of the error is the script can not find the root of the Drupal installation to correctly include one or the core include files.
The short-term HACK is to define the directory path from the module to the root of the Drupal installation. I will provide where to edit the file until I can find a multi-operating system/php solution.
If you are reading this and have a similar problem please post your errors and or fixes
!!!!! ONLY APPLY THIS CHANGE IF YOU ARE EXPERIENCE ERRORS !!!!!
file: node_access.module
line 124: 'file' => node_access_path_to_root(getcwd()) . drupal_get_path('module', 'node') .'/node.pages.inc',
change to: 'file' => '../../../../'. drupal_get_path('module', 'node') .'/node.pages.inc',
line 135: 'file' => node_access_path_to_root(getcwd()) . drupal_get_path('module', 'node') .'/node.pages.inc',
change to: 'file' => '../../../../'. drupal_get_path('module', 'node') .'/node.pages.inc',
line 144: 'file' => node_access_path_to_root(getcwd()) . drupal_get_path('module', 'node') .'/node.pages.inc',
change to: 'file' => '../../../../'. drupal_get_path('module', 'node') .'/node.pages.inc',
In order to fix the problem once you have made the change you must rebuilt the menu cache. This can be accomplished with the link of the link if you have the devel module installed otherwise I have read if you just go to "admin/build/modules" it will force Drupal to rebuild the menu cache.
in the example changes I may have provided too many '../../../../', if the error continues try using just three directory up statements "../../../"
Thanks,
Comment #6
joel_guesclin commentedI think I am getting the same problem, here is the message:
I have just installed the module and begun to use it - no real success yet. But this seems strange to me since apparently Organic Groups depends on this module? Surely lots of other people have the problem?
Comment #7
rob_connolly commentedHi,
I get the same problem:
Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/node_access/./../../modules/node/node.pages.inc' (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/autcnz/autc.org.nz/includes/menu.inc on line 346Not tried the above fixes yet.
EDIT: The above fix works with 4x ../ i.e. "../../../../". It's messy but at least it works!
Comment #8
emptyvoid commentedThanks Rob for following up, for now this hack seems to be the only fix that works. It isn't elegant but it works and until I submitted the modules onto Drupal.org the "../../../../" technique was what I used before. It totally depends on the Drupal core source code location on your host and for the projects I have used it on it wasn't an issue (60+) sites so far. I really wish Drupal had a series of utility functions to provide absolute paths from the current execution directory to the root of the Drupal installation. Right now they only have methods to find core/contributed paths from the root.
If anyone has recommendations on how to improve the functions I am using I would be eager to hear it. Until then I recommend changing the paths manually.
Comment #9
Guzzirider commentedOn my installation is required to set a '/' first.
eg: /../../../../
Than this hack works fine.
Comment #10
emptyvoid commentedFinally,
I have successfully recreated the bug listed here and I will commit a fix to head. Please down and test the release, if all goes well I will release a security fix.
Comment #11
Manonline commentedhi! i'm having the same problem
when i try to access to the content with the admin user i have this error:
Fatal error: require_once() [function.require]: Failed opening required 'modules/node_access/../modules/node/node.pages.inc' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\drupal\includes\menu.inc on line 346
then when i go to the administration page i have this warning:
warning: require_once(modules/node_access/../modules/node/node.pages.inc) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\drupal\includes\menu.inc on line 346.
i have configurated the permissions per content type, but i have access denied error with a normal user when i try to access de node.
the module was working fine, but then it started to give me that errors.
i'm using drupal 6.10, node_access 1.2
windows xp sp 3
local server
mysql 5.1.30
php 5.2.8
thanks and sorry for my english :)
Comment #12
emptyvoid commentedAH oh no!
Ok I would recommend using the 6.X-1.1 build then until I can track down the nature of the bug. I would guess it is a linux/apache verses windows/IIS issue with pathing resolution. :(
Comment #13
Manonline commentedi was using the 1.1 build, but when the error happened, i updated to 1.2, but the error still happening.
Comment #14
emptyvoid commentedIf you revert to the 1.1 version you must rebuild your menus and clear all cache tables
Comment #15
Manonline commentedthat's ok! sorry, but how can i rebuild my menus?
Comment #16
emptyvoid commentedThe act of clearing all cache tables will force drupal to rebuild the menu cache. Please post any errors you get if this doesn't fix your problem.
Comment #17
emptyvoid commentedYou may also want to include this module, ignore the theme modules but use the devel developer block. It makes is easy to conduct maintenance on our site.
Just make sure you hide the module block from other users.
http://drupal.org/project/devel
Comment #18
Manonline commentedwell... i'm still having the problem...
here is the error with the original node_access.module
Fatal error: require_once() [function.require]: Failed opening required 'modules/node_access/./modules/node/node.pages.inc' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\drupal\includes\menu.inc on line 346
and this is the error with the node_access.module modification that i read above
Fatal error: require_once() [function.require]: Failed opening required 'modules/node_access/../../../../modules/node/node.pages.inc' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\drupal\includes\menu.inc on line 346
i installed the devel module and i'm seeing that it is very helpful!!
hey! thank you very much!
mariano.
Comment #19
emptyvoid commentedIt appears you put the community module into the drupal core modules directory. You shouldn't do that, instead you should put your community modules in /sites/all/modules/
Comment #20
Manonline commentedyes, the module was in the drupal core module directory, but now is in /sites/all/modules and the error still happening hehehe
Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/node_access/./modules/node/node.pages.inc' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\drupal\includes\menu.inc on line 346
but it doesnt matter, it isnt critical... but is something personal now!
Comment #21
emptyvoid commentedYou need to uninstall the modules completely when moving it. Then you need to clear all of your cache tables.
The [system] table will have paths to the modules that may be wrong. If uninstall doesn't do what it is suppose to you will have to manually update the paths to the modules.
The [cache_*] tables should be cleared just to make sure old paths in the menu are not giving you a false negative..
Try that and then let me know if it is fixed.
Comment #22
abu3abdalla commentedi have installed it today in my new drupal installtion and i get that error
Comment #23
coltranenode_access_path_to_root() is not needed if you change the node menu overrides to use drupal_load() instead. This would prevent the fatal error.
This needs more testing (I'm just trying this module out) but what I'm proposing is changing the file attribute of the menu item from:
to:
Aside: hook_menu_alter() is a perhaps better approach for overriding the core menu items to use your own access callbacks and actually would mean that the rest of the menu item wouldn't need to be touched.
Comment #24
emptyvoid commentedThank you!
I was really hoping I would get constructive feedback from the community.
I will apply this change to all security modules in my package and conduct a regression test on multiple servers configurations.
Sadly I won't be able to provide any results until the weekend.. at the latest.
Comment #25
alpirrie commentedThanks for your #19 post. The same error happened for me, but it seems it was only because I had loaded the modules into the core modules folder (modules/) and not into the all-sites folder (sites/all/modules/). I uninstalled this module along with the menu_access and admin_access modules, and then (probably stupidly) ran update.php. This caused my 'navigation' menu to 'flatten' - almost all the items lost their hierarchical positions. (I had to reposition everything again!!)
Nevertheless, installing the node_access module into sites/all/modules worked well, and I did not get a repeat of the error, so the module is working fine now - thanks!
I'm new to Drupal (having just switched from Joomla), but so far my impression is v. favourable towards Drupal. The Joomla code seems unnecessarily dense and the system is very clunky in some aspects.
Anyway, don't know whether the menu flattening thing was because I ran update.php or because of the uninstall procedure. You might like to check this out ...
(Running Drupal 6.10 on Mac OSX 10.5.6 with Apache, MySQL & PHP 5.2.6)
Comment #26
emptyvoid commentedHey Alpirrie,
Thanks for following up, I will indeed research the uninstall issue and see if I can reproduce it. If installed in the sites/all/modules I haven't experienced the problem you have outlined. But perhaps it is only related to installing the modules into the core.
I will research this and post my findings.
Comment #27
emptyvoid commentedHere is an update on the latest release,
The recommendation coltrane provided on post #23 doesn't work in the context of a menu. The menu hook is a registry that is compiled by Drupal each time the router table is rebuilt. The registry records pointers to files that should be loaded based on the path that a user is requesting.
The drupal_load method actually includes the file the first time it is evaluated instead of providing a path to the file. Any paths defined after the first call to drupal_load will not load the file, but instead return a value of "true". This is not what is expected and thus all of the displays fail.
I am going to issue a new release and back-port the release to the 6.x-1.3 tag source code. Sadly I can't revoke a release but just issue a new one.
Comment #28
hexabinaerAwfully sorry, issue not fixed.
I happened to download the module today for the very first time (into sites/all/modules right away), activated, and checked the assumendly appropriate permissions.
The error message appears twice (identically):
warning: require_once(sites/all/modules/node_access/../modules/node/node.pages.inc) [function.require-once]: failed to open stream: No such file or directory in D:\roots\testproject\includes\menu.inc on line 346.
-----
Drupal 6.10 on WinXP w/ XAMPP
contrib' modules: cck, views, taxonomy menu, advanced help, custom breadcrumbs, pathauto, site map, theme settings api, token, token actions, transliteration, google analytics
-----
emptyvoid, thanks for keeping track of the issues so regularly :-)
Comment #29
hctomI guess the only way to fix this problem is to move all menu item alter code to hook_menu_alter() and only change the proprties you really have to change (as far as I see it is only the access callback, right?):
Cheers
hctom
Comment #30
fuerst commentedThe attached patch corrects building the ../ trail to the Drupal root necessary for inclusion of the node.pages.inc in the node_access_menu() items.
Problem was the getcwd() call which returns the current working directory of the main script, not the file were getcwd() was called. The main script always is Drupal's index.php. Therefore the calculation of the ../ trail failed.
The patch just uses
drupal_get_path('module', 'node_access')to get the current location relative to the Drupal root. It then counts how deep this is and usesstr_repeat()to build the ../ trail back to the Drupal root.Comment #31
fuerst commentedHm, here is a better way to load the node.pages.inc: Use the 'file path' item attribute of hook_menu() to correctly hand over the path to the file to be loaded:
The attached patch fixes this against vanilla 6.x-1.5.
Don't forget to empty the (menu) cache in Drupal after applying the patch.
Comment #32
eelkeblokJust tested #31, seems to be working fine (I was having the same issue).
Comment #33
fuerst commentedThanks for testing: I set the status to "reviewed & tested by the community" now.
Comment #34
emptyvoid commentedGreat patch I will roll the patch into the fixes I plan to release this weekend. Sadly I have been very, very, very busy.
Comment #35
rob_connolly commentedDamn, I thought I'd fixed this! I just upgraded and it happened again.
I've tried both the #5 and the #31 fixes but neither seem to be working. Whatever I change the file line to I seem to get the same error.
Very weird!
EDIT: Actually ignore my comment, it seems I have a problem on my server. Fixed it now. #31 seems to be a better way to go about this, hopefully it'll be in the next release.
Comment #36
emptyvoid commentedPatch applied and issued new release