Jump to content

Indirect modification of overloaded property ProcessWire\Config


Can
 Share

Recommended Posts

I know about this post https://processwire.com/talk/topic/12198-modifying-config-property-eg-sitesettings-from-readyphp/

But I'm not modifying the settings somewhere else..

So my problem is about $config->httpHosts I'm getting this one on staging server when debug is enabled

Quote

Notice: Indirect modification of overloaded property ProcessWire\Config::$httpHosts has no effect in
/PATH/wire/core/ProcessWire.php on line 758

I'm just setting this in config.php as usual, tried various ways, this is how I would love it to be

$config->domain = 'staging.domain.com';

$config->httpHosts = [
  $config->domain,
  "www.$config->domain",
  "assets0.$config->domain",
  "assets1.$config->domain",
  "assets2.$config->domain",
  "assets3.$config->domain"
];

Then I only need to ensure $config->domain is set right in config and I can use it in other places, too..

Anyway, I stripped the line breaks, reduced the number of hosts, inlined the domain, changed [] to array(), commented the whole thing out..changed php from 5.6 cgi to 7 cgi, and tried to array merge with $config->httpHosts with no changes at all and now I have no idea what to do.
Can just disable debug and at least the message disappears, but that won't fix the problem...would it??

Uh, another installation on the same host works just fine, just enabled debug, no error..

Link to comment
Share on other sites

6 hours ago, Can said:

I'm just setting this in config.php as usual, tried various ways, this is how I would love it to be


$config->domain = 'staging.domain.com';

$config->httpHosts = [
  $config->domain,
  "www.$config->domain",
  "assets0.$config->domain",
  "assets1.$config->domain",
  "assets2.$config->domain",
  "assets3.$config->domain"
];

If $config->domain is staging.domain.com (it already includes a subdomain) then that makes your httpHosts array resolve as:

staging.domain.com,
  www.staging.domain.com,
  assets0.staging.domain.com,
  assets1.staging.domain.com,
  assets2.staging.domain.com,
  assets3.staging.domain.com

So instead you probably want something like:

$config->domain = 'domain.com';

$config->httpHosts = [
  $config->domain,
  "staging.$config->domain",
  "www.$config->domain",
  "assets0.$config->domain",
  "assets1.$config->domain",
  "assets2.$config->domain",
  "assets3.$config->domain"
];

 

Link to comment
Share on other sites

The way I read the code in ProcessWire.php, this notice should only ever be triggered if you're bootstrapping PW and passing in a URL as the second parameter that contains a hostname not listed in $config->httpHosts. Is this generated by a bootstrap script? Which PW version do you use?

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...