Skip to content

Conversation

@OndraM
Copy link

@OndraM OndraM commented Sep 25, 2023

When using local PHP server, the 'REQUEST_SCHEME' is empty for me, causing the script to fail:

Warning: Undefined array key "REQUEST_SCHEME"

This will fallback to 'http' when REQUEST_SCHEME is set.

@roelofjan-elsinga
Copy link
Contributor

This referrer currently breaks my installation as I'm only using this package with a local CLI script. This PR would fix my problem.

@metzg
Copy link

metzg commented Nov 18, 2023

In my case (CLI script), the following keys were missing: REQUEST_SCHEME, HTTP_HOST, REQUEST_URI. Would you consider adding those two other keys in your patch?

A workaround I found without this patch was to set those values manually before calling getImage, but it's not ideal:

$_SERVER['REQUEST_SCHEME'] = $_SERVER['REQUEST_SCHEME'] ?? 'https';
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_HOST'] ?? 'example.com';
$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ??  '';

// ...

$foo->getImage();

Thanks,

@DantSu
Copy link
Owner

DantSu commented Nov 18, 2023

Yes, this workaround is a better way than the patch, because you can set custom value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants