PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
← All changes | modules/GuzzleHttp/Handler/StreamHandler.php +23 -52 trunk1.9.2 View file →
@@ -66,9 +66,9 @@
66 66 // This list can probably get more comprehensive.
67 67 if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed
68 68 || false !== \strpos($message, 'Connection refused')
69 69 || false !== \strpos($message, "couldn't connect to host") // error on HHVM
70 - || false !== \strpos($message, 'connection attempt failed')
70 + || false !== \strpos($message, "connection attempt failed")
71 71 ) {
72 72 $e = new ConnectException($e->getMessage(), $request, $e);
73 73 } else {
74 74 $e = RequestException::wrapException($request, $e);
@@ -230,12 +230,11 @@
230 230 $errors = [];
231 231 \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool {
232 232 $errors[] = [
233 233 'message' => $msg,
234 - 'file' => $file,
235 - 'line' => $line,
234 + 'file' => $file,
235 + 'line' => $line
236 236 ];
237 -
238 237 return true;
239 238 });
240 239
241 240 try {
@@ -247,9 +246,9 @@
247 246 if (!$resource) {
248 247 $message = 'Error creating resource: ';
249 248 foreach ($errors as $err) {
250 249 foreach ($err as $key => $value) {
251 - $message .= "[$key] $value".\PHP_EOL;
250 + $message .= "[$key] $value" . \PHP_EOL;
252 251 }
253 252 }
254 253 throw new \RuntimeException(\trim($message));
255 254 }
@@ -266,12 +265,8 @@
266 265 if (!$methods) {
267 266 $methods = \array_flip(\get_class_methods(__CLASS__));
268 267 }
269 268
270 - if (!\in_array($request->getUri()->getScheme(), ['http', 'https'])) {
271 - throw new RequestException(\sprintf("The scheme '%s' is not supported.", $request->getUri()->getScheme()), $request);
272 - }
273 -
274 269 // HTTP/1.1 streams using the PHP stream wrapper require a
275 270 // Connection: close header
276 271 if ($request->getProtocolVersion() == '1.1'
277 272 && !$request->hasHeader('Connection')
@@ -322,9 +317,9 @@
322 317
323 318 return $this->createResource(
324 319 function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) {
325 320 $resource = @\fopen((string) $uri, 'r', false, $contextResource);
326 - $this->lastHeaders = $http_response_header ?? [];
321 + $this->lastHeaders = $http_response_header;
327 322
328 323 if (false === $resource) {
329 324 throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context);
330 325 }
@@ -350,9 +345,8 @@
350 345 $records = \dns_get_record($uri->getHost(), \DNS_A);
351 346 if (false === $records || !isset($records[0]['ip'])) {
352 347 throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
353 348 }
354 -
355 349 return $uri->withHost($records[0]['ip']);
356 350 }
357 351 if ('v6' === $options['force_ip_resolve']) {
358 352 $records = \dns_get_record($uri->getHost(), \DNS_AAAA);
@@ -358,10 +352,9 @@
358 352 $records = \dns_get_record($uri->getHost(), \DNS_AAAA);
359 353 if (false === $records || !isset($records[0]['ipv6'])) {
360 354 throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
361 355 }
362 -
363 - return $uri->withHost('['.$records[0]['ipv6'].']');
356 + return $uri->withHost('[' . $records[0]['ipv6'] . ']');
364 357 }
365 358 }
366 359
367 360 return $uri;
@@ -377,22 +370,19 @@
377 370 }
378 371
379 372 $context = [
380 373 'http' => [
381 - 'method' => $request->getMethod(),
382 - 'header' => $headers,
374 + 'method' => $request->getMethod(),
375 + 'header' => $headers,
383 376 'protocol_version' => $request->getProtocolVersion(),
384 - 'ignore_errors' => true,
385 - 'follow_location' => 0,
377 + 'ignore_errors' => true,
378 + 'follow_location' => 0,
386 379 ],
387 - 'ssl' => [
388 - 'peer_name' => $request->getUri()->getHost(),
389 - ],
390 380 ];
391 381
392 382 $body = (string) $request->getBody();
393 383
394 - if ('' !== $body) {
384 + if (!empty($body)) {
395 385 $context['http']['content'] = $body;
396 386 // Prevent the HTTP handler from adding a Content-Type header.
397 387 if (!$request->hasHeader('Content-Type')) {
398 388 $context['http']['header'] .= "Content-Type:\r\n";
@@ -477,27 +467,8 @@
477 467
478 468 /**
479 469 * @param mixed $value as passed via Request transfer options.
480 470 */
481 - private function add_crypto_method(RequestInterface $request, array &$options, $value, array &$params): void
482 - {
483 - if (
484 - $value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
485 - || $value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
486 - || $value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
487 - || (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT)
488 - ) {
489 - $options['http']['crypto_method'] = $value;
490 -
491 - return;
492 - }
493 -
494 - throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided');
495 - }
496 -
497 - /**
498 - * @param mixed $value as passed via Request transfer options.
499 - */
500 471 private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void
501 472 {
502 473 if ($value === false) {
503 474 $options['ssl']['verify_peer'] = false;
@@ -563,29 +534,29 @@
563 534 return;
564 535 }
565 536
566 537 static $map = [
567 - \STREAM_NOTIFY_CONNECT => 'CONNECT',
538 + \STREAM_NOTIFY_CONNECT => 'CONNECT',
568 539 \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED',
569 - \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
570 - \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
571 - \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
572 - \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
573 - \STREAM_NOTIFY_PROGRESS => 'PROGRESS',
574 - \STREAM_NOTIFY_FAILURE => 'FAILURE',
575 - \STREAM_NOTIFY_COMPLETED => 'COMPLETED',
576 - \STREAM_NOTIFY_RESOLVE => 'RESOLVE',
540 + \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
541 + \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
542 + \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
543 + \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
544 + \STREAM_NOTIFY_PROGRESS => 'PROGRESS',
545 + \STREAM_NOTIFY_FAILURE => 'FAILURE',
546 + \STREAM_NOTIFY_COMPLETED => 'COMPLETED',
547 + \STREAM_NOTIFY_RESOLVE => 'RESOLVE',
577 548 ];
578 549 static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max'];
579 550
580 551 $value = Utils::debugResource($value);
581 - $ident = $request->getMethod().' '.$request->getUri()->withFragment('');
552 + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment('');
582 553 self::addNotification(
583 554 $params,
584 555 static function (int $code, ...$passed) use ($ident, $value, $map, $args): void {
585 556 \fprintf($value, '<%s> [%s] ', $ident, $map[$code]);
586 557 foreach (\array_filter($passed) as $i => $v) {
587 - \fwrite($value, $args[$i].': "'.$v.'" ');
558 + \fwrite($value, $args[$i] . ': "' . $v . '" ');
588 559 }
589 560 \fwrite($value, "\n");
590 561 }
591 562 );
@@ -598,9 +569,9 @@
598 569 $params['notification'] = $notify;
599 570 } else {
600 571 $params['notification'] = self::callArray([
601 572 $params['notification'],
602 - $notify,
573 + $notify
603 574 ]);
604 575 }
605 576 }
606 577