Fix Win32 SSPI initialization for digest authentication in cURL #1102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since cURL 7.40.0, HTTP Digest Authentication support is now handled by Windows SSPI.
To initialize cURL, the php_curl module uses curl_global_init(CURL_GLOBAL_SSL); This call skips initializing any Win32 specific features (see curl_global_init in cURL lib/easy.c).
As a result, the SSPI interface is not initialized and attempting to use HTTP Digest Authentication results in referencing a null pointer, s_pSecFn, in Curl_sasl_create_digest_http_message (lib/curl_sasl_sspi.c).
To fix, PHP_MINIT_FUNCTION should call curl_global_init with CURL_GLOBAL_DEFAULT. This will not affect non-Win32 platforms and is the cURL recommended default.
This was tested with the official Windows PHP binaries, 5.6.6 VC11 x86 Thread Safe, running on Windows 8.1 x64.
See bug #69088 https://bugs.php.net/bug.php?id=69088