silverstripe / sspak

Tool for managing bundles of db/assets from Silverstripe environments
http://silverstripe.github.io/sspak/
BSD 3-Clause "New" or "Revised" License
47 stars 34 forks source link

Notice: Undefined index: REQUEST_URI #30

Closed purplespider closed 8 years ago

purplespider commented 9 years ago

Trying to save from a remote server with sspak save USER@SERVER:/home/[username]/public_html site.sspak, but getting this:

Could not parse sspak-sniffer content:

Notice: Undefined index: REQUEST_URI in /home/[username]/public_html/framework/control/Director.php on line 892
<p>Redirecting to <a href="" title="Click this link if your browser does not redirect you">...</a></p>
<meta http-equiv="refresh" content="1; url=" />
<script type="text/javascript">setTimeout(function(){
    window.location.href = "";
}, 50);</script>";
dhensby commented 9 years ago

Do you have $_FILE_TO_URL_MAPPING set up in your environment file? see: https://docs.silverstripe.org/en/3.1/developer_guides/cli/

purplespider commented 9 years ago

Yep, tried that Dan. Same message.

dhensby commented 8 years ago

So we think this is related to Director::forceWWW() - are you using this on your production site?

If so, can you wrap it in if (!Director::is_cli()) { ... } to see?

We have a ticket open on framework for this (https://github.com/silverstripe/silverstripe-framework/pull/4025)

purplespider commented 8 years ago

Thanks Dan, that did the trick!

I was using if(isset($_SERVER['HTTP_HOST'])) { ... } to get around this problem before, but it seems like it doesn't work for SSPak or Platform, whereas if (!Director::is_cli()) { ... } does.

dhensby commented 8 years ago

Ah, yes the $_FILE_TO_URL_MAPPING mapping means that the $_SERVER['HTTP_HOST'] gets polly-filled with a value, so that check would fail.