Notice: Undefined index: path in domain_url_outbound_alter().

I realize this info is not relevant to this issue but since you asked:
php: 5.3.10
db: 5.5.33a-MariaDB-1~precise-log
Appears on all pages

I'm setting $domain['path'] = domain_get_path($domain); in hook_domain_load() but I was getting Notices when ['path'] wasn't set.

This fixes that for me $options['base_url'] = isset($path_lookup[$name]['path']) ? rtrim($path_lookup[$name]['path'], '/') : $GLOBALS['base_url'];

This isn't the cause of the Notice but wanted to at least bring it up:
There are times for me where $path is not set in
function domain_url_outbound_alter(&$path, &$options, $original_path) { ... }

I added $path = !empty($path) ? $path : $_GET['q']; so that when this is the case, setting $name = md5($path); there is a string being passed.

I've set up Domain Access so that it works across environments (dev/stage/prod). I have another patch I will post after this one (different topic) and maybe that will shed some more light as to why I may be getting this error. I will post a link here when I get it up in case it may be related.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scottalan’s picture

scottalan’s picture

Here is the link to the other issue I opened that better explains my environment. https://drupal.org/node/2159443

rancidl’s picture

I am also having the same issue since installing domain access on a clean install. I implemented the patch but still receive the error. Notice: Undefined index: path in domain_url_outbound_alter() (line 100 of [...]/sites/all/modules/domain/settings_custom_url.inc)

This bug report is the only mention of this and I cannot seem to figure out how to correct the issue. It also appears on all pages. Can you help?

scottalan’s picture

@louisan

I'll do my best. Are you confident that the patch actually applied? I had a look at it and it seems that line 100 is if ($use_source) { in the settings_custom_url.inc file after the patch is applied. Can you set a breakpoint after $path gets set and tell me what it gets set to for each page load? If you don't have a way to debug it in an IDE then install the devel module and do: dpm($path); right after the path is set in the domain_url_outbound_alter function.

rancidl’s picture

@scottalan, you are wonderful. Line 100 (after applying the patch and including additional comments about the revision) was $options['base_url'] = rtrim($domain[$nid]['path'], '/'); . So I used the code you wrote for $name but changed it to $nid. My file now has 3 revised lines. Just pointing out the line number again made me look harder at that. Thanks.

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)

There is something very, very odd going on here. There is no reason for $path to be empty. That would mean that core is trying to alter a path that hasn't been created yet, which suggests something is firing out of order.

Steps to replicate?