Fatal Error :-S
Zahor - October 27, 2008 - 01:33
| Project: | Subdomain |
| Version: | 6.x-1.4 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
I get a Fatal Error: Call to undefined function subdomain_url_rewrite_inbound() ...in settings.php.
Don't understand this error since the module is installed and the function is there.
I'm confused. The subdomain_url_rewrite_outbound() works fine.

#1
Check the spelling on both functions: are they both spelled correctly?
Can you paste the relevant section of your settings.php file in a comment below?
#2
Modified to stop fatal errors (with function_exists):
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
// Used by the Subdomain module to generate URLs with subdomains
if (module_exists('subdomain')) {
subdomain_url_rewrite_outbound($path, $options);
}
}
function custom_url_rewrite_inbound(&$result, $path, $path_language) {
// Used by the Subdomain module to correctly interpret URLs with subdomains
if (module_exists('subdomain')) {
if(function_exists(subdomain_url_rewrite_inbound)) {
subdomain_url_rewrite_inbound($result, $path, $path_language);
}
}
}
#3
This code worked at last!!!!
#4
Yep works!!
#5
ummm..... doesn't seem right to just remove that from the subdomain settings.php additions.
I added the check just to get the module limping along and found the outbound rewrites to work, but the inbounds do not point to the node, which would make sense when commenting out that function reference in the settings.php file.
Helps?
#6
I've done a bit of digging, and it seems it depends on what other modules you've got enabled.
Here's how you can dig yourself:
<?phpfunction custom_url_rewrite_inbound(&$result, $path, $path_language) {
// Used by the Subdomain module to correctly interpret URLs with subdomains
if (module_exists('subdomain')) {
if(!function_exists('subdomain_url_rewrite_inbound')) {
debug_print_backtrace(); exit();
}
subdomain_url_rewrite_inbound($result, $path, $path_language);
}
}
?>
View the source in that page. You should see a backward look at what function called what function, called what function etc. Look at what module tried to call the function that little bit too early. In my case it was og_user_roles, and here's my sample output:
You can see the
custom_url_rewrite_inboundhit, followed by some Drupal internals, followed by ahook_bootimplementation for og_user_roles.The problem happens in Drupal's bootstrap phase. In this phase, Drupal only brings in the modules it really needs: these are identified by having a
hook_bootimplementation.Now, there does exist a
subdomain_boot. However, it's only brought in by Drupal when that module is being bootstrapped, and by default modules get summoned in alphabetical order. Hence og_user_roles tries to rewrite a URL and keels over.Solution: open a MySQL prompt and type
UPDATE system SET weight = -200 WHERE name = 'subdomain';You can set the weight to any negative number, as long as it weights the module above whatever's calling it. To see what the offending module is weighted at, typeSELECT WEIGHT FROM system WHERE name = 'og_user_roles';, replacing that with whatever module came out of thedebug_print_backtrace.If this works, then this isn't on its own a bugfix for the module: it also needs to go into the module's
.installfile, as it's necessary for thehook_boottrick to work properly!