@@ -111,9 +111,9 @@ public function setPath(string $path, bool $verifyFile = true, ?ZipArchive $zip
111111 $ this ->isUrl = true ;
112112 $ ctx = null ;
113113 // 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 = [
117117 'http ' => [
118118 '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 ' ,
119119 'header ' => [
@@ -122,7 +122,11 @@ public function setPath(string $path, bool $verifyFile = true, ?ZipArchive $zip
122122 '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 ' ,
123123 ],
124124 ],
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 );
126130 }
127131 $ imageContents = @file_get_contents ($ path , false , $ ctx );
128132 if ($ imageContents !== false ) {
@@ -193,6 +197,8 @@ public function getIsURL(): bool
193197 * Set isURL.
194198 *
195199 * @return $this
200+ *
201+ * @deprecated 3.7.0 not needed, property is set by setPath
196202 */
197203 public function setIsURL (bool $ isUrl ): self
198204 {
0 commit comments