@@ -111,9 +111,9 @@ public function setPath(string $path, bool $verifyFile = true, ?ZipArchive $zip
111
111
$ this ->isUrl = true ;
112
112
$ ctx = null ;
113
113
// https://github.com/php/php-src/issues/16023
114
- if ( str_starts_with ( $ path , ' https: ' )) {
115
- $ ctx = stream_context_create ([
116
- ' ssl ' => [ ' crypto_method ' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT],
114
+ // https://github.com/php/php-src/issues/17121
115
+ if ( str_starts_with ( $ path , ' https: ' ) || str_starts_with ( $ path , ' http: ' )) {
116
+ $ ctxArray = [
117
117
'http ' => [
118
118
'user_agent ' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 ' ,
119
119
'header ' => [
@@ -122,7 +122,11 @@ public function setPath(string $path, bool $verifyFile = true, ?ZipArchive $zip
122
122
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 ' ,
123
123
],
124
124
],
125
- ]);
125
+ ];
126
+ if (str_starts_with ($ path , 'https: ' )) {
127
+ $ ctxArray ['ssl ' ] = ['crypto_method ' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT];
128
+ }
129
+ $ ctx = stream_context_create ($ ctxArray );
126
130
}
127
131
$ imageContents = @file_get_contents ($ path , false , $ ctx );
128
132
if ($ imageContents !== false ) {
@@ -193,6 +197,8 @@ public function getIsURL(): bool
193
197
* Set isURL.
194
198
*
195
199
* @return $this
200
+ *
201
+ * @deprecated 3.7.0 not needed, property is set by setPath
196
202
*/
197
203
public function setIsURL (bool $ isUrl ): self
198
204
{
0 commit comments