Skip to content

Fixes error, 'Undefined array key "REQUEST_SCHEME"' in some cases. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bcash
Copy link

@bcash bcash commented Oct 11, 2024

Not all servers provide a value for REQUEST_SCHEME. This offers a fallback in this case.

Please see https://stackoverflow.com/questions/18008135/is-serverrequest-scheme-reliable for discussion

Not all servers provide a value for REQUEST_SCHEME.  This offers a fallback in this case.

Please see https://stackoverflow.com/questions/18008135/is-serverrequest-scheme-reliable for discussion
@bcash
Copy link
Author

bcash commented Oct 11, 2024

Additional notes:

I noticed the previous PR #8 was based on CLI usage only and that setting the $_SERVER value in the environment was the preferred solution.

However, when running in non-CLI, $_SERVER may only be fixed by changing the server environment. This is not always possible.

Also, $curlOptions with a valid CURLOPT_REFERER may be passed in. But regardless of that, $defaultCurlOptions is still created, always referencing this undefined array key.

An alternative fix would be to define $defaultCurlOptions only if $curlOptions is null, but overriding this option is tricky and annoying as the custom referrer has to pass through three calls. But also in this case, the code will simply not work on installation for some developers running on these servers.

@bcash bcash closed this Oct 11, 2024
@bcash bcash deleted the patch-1 branch October 11, 2024 14:17
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.

1 participant