Posted by deckerdev on November 13, 2010 at 12:49am
3 followers
Jump to:
| Project: | Ubercart Domain Access |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
After successful checkout, I get 2 of the exact same warning messages:warning: Invalid argument supplied for foreach() in /home/ghcart/public_html/sites/all/modules/uc_domain/uc_domain.module on line 257.
Any ideas?
Comments
#1
It doesent look like this module is being supported so...
line 257 of uc_domain.module checks for $domain['alias'] when it should check for $domain['aliases'] and also it should only do the test for aliases if the domain _alias module is enabled.
I am not a skilled php coder so check my work but I changed lines 254-270 from:
<?php
$domain = domain_lookup($vars['domain_id']);
$is_alias = FALSE;
foreach ($domain['aliases'] as $alias) {
// Check if current base url is an alias, f.ex localhost
if (strpos($original_base_url, $alias['pattern'])) {
$is_alias = TRUE;
}
}
if (!$is_alias) {
// Temporarily replace global $base_url so url() returns correct results for the domain.
$base_url = $domain['path'];
if (substr($base_url, -1) == '/') {
$base_url = substr($base_url, 0, -1);
}
}
?>
To:
<?php
if (module_exists('domain_alias')) {
$domain = domain_lookup($vars['domain_id']);
$is_alias = FALSE;
foreach ($domain['aliases'] as $alias) {
// Check if current base url is an alias, f.ex localhost
if (strpos($original_base_url, $alias['pattern'])) {
$is_alias = TRUE;
}
}
if (!$is_alias) {
// Temporarily replace global $base_url so url() returns correct results for the domain.
$base_url = $domain['path'];
if (substr($base_url, -1) == '/') {
$base_url = substr($base_url, 0, -1);
}
}
}
?>
#2
I had the same issue and #1 fixed it.
Hope it will be commited.