Closed (fixed)
Project:
Pathauto
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2008 at 13:04 UTC
Updated:
14 Apr 2009 at 23:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
gregglesI believe the style of that require_once is the same as a core and a lot of other popular modules. Can you find examples of modules/core where it uses the anchor as you describe?
Comment #2
gpk commentedSure!
#296194: Some includes are not anchored
OK that's the ones that don't confirm ;)
But you are probably right about contrib modules not behaving very well in this regard.
Comment #3
greggles#259623: Broken autoloader: convert includes/requires to use absolute paths
That's what I was looking for. So, yes, let's fix this to be like core.
Comment #4
greggles@gpk - how does this look?
@everyone else - tests? please?
Comment #5
gpk commentedLooks fine to me :D but haven't tested it.
Comment #6
jwilson3I just tested the patch and it still generates the same error, the only difference is that now there's an additional ./ in the error message.
Before:
After:
I'm willing to test this further if anyone comes up with other ideas. Its really killing me to have php errors showing up every 45 minutes in my logs. Ok, well not really killing me, but yeah, its bucking the flow of the tao...
:/
Comment #7
gpk commentedThat's odd.
Are you sometimes able to access pathauto functionality *without* the error appearing? e.g. the normal pathauto admin screen? I'd have thought that error would stop it from working at all really.
Unless it only happens on certain page views. What other info is in the log, e.g. what page does it relate to?
Also you could try putting this line in immediately before the first require_once:
This may generate zillions of harmless entries (which you can easily delete later) but may also reveal the vital clue as and when the actual error occurs. In that something may have changed the cwd.
Comment #8
jwilson3it doesn't relate to a page/node/or any other normal "live site" functionality. This php error appears in watchdog only DIRECTLY AFTER a "Cron Complete" message. There is no other information I can supply at this point other than the error message that's already been outlined. Its only happening on a production server so I'm not too keen on enabling php backtrace.
Comment #9
gpk commentedOK that's helpful. How are you running cron? Do you get this error message if you use the "run cron" link on the status page and also if cron.php is run from crontab and directly from a browser? Have you tried adding the debugging snippet at #7?
Comment #10
jwilson3i run cron via crontab. i added the snippet, but it generated too much stuff in watchdog i couldnt track down the one case where the value may have been different. My site is live and gets about 2000 hits an hour, so it makes this snippet impossible to use for debugging.
maybe i should try it wrapped in an if statement that only prints watchdog if the value is anything else than the expected value.... i'll try it and get back to you.
Comment #11
jwilson3The current working directory is "/" just before the error occurs. I wanted to double check to see if any rogue modules had somehow changed the cwd during a cron run, but it appears to not be a factor.
I added the following inside the foreach loop of includes/module.inc:module_invoke_all (called by drupal_cron_run)
The results generate the following in watchdog
Note that before the "cron run completed" the entries actually match the expected $path_to_drupal so the change to "/" occurs after cron.
Any ideas how i can find out more exactly when that happens or who's causing it???
Comment #12
jwilson3the message from previous comment "Akismet cron started at 19:25:22." seems suspicious to me, but I dont know how or where to debug this any further.
Comment #13
jwilson3I've narrowed it down to the php function register_shutdown_function!
Functions that are registered to run at the end of the cron.php script seem to have cwd set to "/".
The offending code that ends up calling pathauto happens after cron, so pathauto is getting executed after all cron runs via one of 8 methods of my drupal install (including core and modules) that registers a shutdown function.
There is a register_shutdown_function('drupal_cron_cleanup'); that is registered during drupal_cron_run(). I put a debug statement inside drupal_cron_cleanup() and sure enough, the cwd in that function is "/".
But nothing is really called in cron_cleanup, so, I'm thinking the most likely candidate is the akismet_cron_shutdown function which is registered during akismet_cron() run, cause it does a whole bunch of stuff.
more to come, maybe...
Comment #14
greggles@jrguitar - the symptoms you had in #337615: require_once failure on cron with modules that have a register_shutdown_function were really similar to this. So, I directed you over here. At this point, your symptoms/causes are totally different from the original point of this issue :(
So...can we move the discussion back over there =D ?
Comment #15
jwilson3ok. moving it back...
Comment #16
Freso commentedIs there a reason we're not simply using
module_load_include()?The attached patch uses this for 6.x... and absolute paths for 5.x-2.x, though a bit differently than the previous one.
Comment #17
gregglesFor 6.x I agree we should use module_load_include.
These look good to me.
Comment #18
Freso commentedAlright. Unless someone else posts negative comments (or you beat me to it ;)), I'll commit these later, when I'm home. :)
Comment #19
gpk commentedJust to confirm that the problem jrguitar21 was having relating to shutdown functions seems essentially to be the same as in this issue #259623: Broken autoloader: convert includes/requires to use absolute paths. The solution there (in core 7.x) was to define the DRUPAL_ROOT constant.
Comment #20
Freso commentedgpk: But
DRUPAL_ROOTisn't available in D6. Are you suggesting we go about this in a different way than #16, or... ?Comment #21
Freso commentedI'm guessing he wasn't.
Committed to 6.x-2.x, 6.x-1.x, and 5.x-2.x.
Comment #22
gpk commentedYou guess right! jrguitar21's bug was fixed in a different way in the event. As you know. #337615: require_once failure on cron with modules that have a register_shutdown_function