PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | vendor_prefixed/guzzlehttp/guzzle/src/functions.php +87 -6 28.1 → trunk View file →
@@ -14,9 +14,22 @@
14 14 * @deprecated describe_type will be removed in guzzlehttp/guzzle:8.0. Use get_debug_type() instead.
15 15 */
16 16 function describe_type($input) : string
17 17 {
18 - return \YoastSEO_Vendor\GuzzleHttp\Utils::describeType($input);
18 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use get_debug_type() instead.', __FUNCTION__);
19 + switch (\gettype($input)) {
20 + case 'object':
21 + return 'object(' . \get_class($input) . ')';
22 + case 'array':
23 + return 'array(' . \count($input) . ')';
24 + default:
25 + \ob_start();
26 + \var_dump($input);
27 + // normalize float vs double
28 + /** @var string $varDumpContent */
29 + $varDumpContent = \ob_get_clean();
30 + return \str_replace('double(', 'float(', \rtrim($varDumpContent, " \n\r\t\x00\v"));
31 + }
19 32 }
20 33 /**
21 34 * Parses an array of header lines into an associative array of headers.
22 35 *
@@ -26,8 +39,9 @@
26 39 * @deprecated headers_from_lines will be removed in guzzlehttp/guzzle:8.0. Use Utils::headersFromLines instead.
27 40 */
28 41 function headers_from_lines(iterable $lines) : array
29 42 {
43 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::headersFromLines() instead.', __FUNCTION__);
30 44 return \YoastSEO_Vendor\GuzzleHttp\Utils::headersFromLines($lines);
31 45 }
32 46 /**
33 47 * Returns a debug stream based on the provided variable.
@@ -39,8 +53,9 @@
39 53 * @deprecated debug_resource will be removed in guzzlehttp/guzzle:8.0. Use Utils::debugResource instead.
40 54 */
41 55 function debug_resource($value = null)
42 56 {
57 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::debugResource() instead.', __FUNCTION__);
43 58 return \YoastSEO_Vendor\GuzzleHttp\Utils::debugResource($value);
44 59 }
45 60 /**
46 61 * Chooses and creates a default handler to use based on the environment.
@@ -54,8 +69,9 @@
54 69 * @deprecated choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils::chooseHandler instead.
55 70 */
56 71 function choose_handler() : callable
57 72 {
73 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::chooseHandler() instead.', __FUNCTION__);
58 74 return \YoastSEO_Vendor\GuzzleHttp\Utils::chooseHandler();
59 75 }
60 76 /**
61 77 * Get the default User-Agent string to use with Guzzle.
@@ -63,8 +79,9 @@
63 79 * @deprecated default_user_agent will be removed in guzzlehttp/guzzle:8.0. Use Utils::defaultUserAgent instead.
64 80 */
65 81 function default_user_agent() : string
66 82 {
83 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::defaultUserAgent() instead.', __FUNCTION__);
67 84 return \YoastSEO_Vendor\GuzzleHttp\Utils::defaultUserAgent();
68 85 }
69 86 /**
70 87 * Returns the default cacert bundle for the current system.
@@ -82,9 +99,55 @@
82 99 * @deprecated default_ca_bundle will be removed in guzzlehttp/guzzle:8.0. This function is not needed in PHP 5.6+.
83 100 */
84 101 function default_ca_bundle() : string
85 102 {
86 - return \YoastSEO_Vendor\GuzzleHttp\Utils::defaultCaBundle();
103 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. This function is not needed in PHP 5.6+.', __FUNCTION__);
104 + static $cached = null;
105 + static $cafiles = [
106 + // Red Hat, CentOS, Fedora (provided by the ca-certificates package)
107 + '/etc/pki/tls/certs/ca-bundle.crt',
108 + // Ubuntu, Debian (provided by the ca-certificates package)
109 + '/etc/ssl/certs/ca-certificates.crt',
110 + // FreeBSD (provided by the ca_root_nss package)
111 + '/usr/local/share/certs/ca-root-nss.crt',
112 + // SLES 12 (provided by the ca-certificates package)
113 + '/var/lib/ca-certificates/ca-bundle.pem',
114 + // OS X provided by homebrew (using the default path)
115 + '/usr/local/etc/openssl/cert.pem',
116 + // Google app engine
117 + '/etc/ca-certificates.crt',
118 + // Windows?
119 + 'C:\\windows\\system32\\curl-ca-bundle.crt',
120 + 'C:\\windows\\curl-ca-bundle.crt',
121 + ];
122 + if ($cached) {
123 + return $cached;
124 + }
125 + if ($ca = \ini_get('openssl.cafile')) {
126 + return $cached = $ca;
127 + }
128 + if ($ca = \ini_get('curl.cainfo')) {
129 + return $cached = $ca;
130 + }
131 + foreach ($cafiles as $filename) {
132 + if (\file_exists($filename)) {
133 + return $cached = $filename;
134 + }
135 + }
136 + throw new \RuntimeException(<<<EOT
137 +No system CA bundle could be found in any of the the common system locations.
138 +PHP versions earlier than 5.6 are not properly configured to use the system's
139 +CA bundle by default. In order to verify peer certificates, you will need to
140 +supply the path on disk to a certificate bundle to the 'verify' request option:
141 +https://github.com/guzzle/guzzle/blob/7.15/docs/request-options.md#verify. If
142 +you do not need a specific certificate bundle, then Mozilla provides a commonly
143 +used CA bundle which can be downloaded here (provided by the maintainer of
144 +cURL): https://curl.se/ca/cacert.pem. Once you have a CA bundle available on
145 +disk, you can set the 'openssl.cafile' PHP ini setting to point to the path to
146 +the file, allowing you to omit the 'verify' request option. See
147 +https://curl.se/docs/sslcerts.html for more information.
148 +EOT
149 +);
87 150 }
88 151 /**
89 152 * Creates an associative array of lowercase header names to the actual
90 153 * header casing.
@@ -92,8 +155,9 @@
92 155 * @deprecated normalize_header_keys will be removed in guzzlehttp/guzzle:8.0. Use Utils::normalizeHeaderKeys instead.
93 156 */
94 157 function normalize_header_keys(array $headers) : array
95 158 {
159 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::normalizeHeaderKeys() instead.', __FUNCTION__);
96 160 return \YoastSEO_Vendor\GuzzleHttp\Utils::normalizeHeaderKeys($headers);
97 161 }
98 162 /**
99 163 * Returns true if the provided host matches any of the no proxy areas.
@@ -117,8 +181,9 @@
117 181 * @deprecated is_host_in_noproxy will be removed in guzzlehttp/guzzle:8.0. Use Utils::isHostInNoProxy instead.
118 182 */
119 183 function is_host_in_noproxy(string $host, array $noProxyArray) : bool
120 184 {
185 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::isHostInNoProxy() instead.', __FUNCTION__);
121 186 return \YoastSEO_Vendor\GuzzleHttp\Utils::isHostInNoProxy($host, $noProxyArray);
122 187 }
123 188 /**
124 189 * Wrapper for json_decode that throws when an error occurs.
@@ -133,13 +198,22 @@
133 198 *
134 199 * @throws Exception\InvalidArgumentException if the JSON cannot be decoded.
135 200 *
136 201 * @see https://www.php.net/manual/en/function.json-decode.php
137 - * @deprecated json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonDecode instead.
202 + * @deprecated json_decode will be removed in guzzlehttp/guzzle:8.0. Use PHP's json_decode() instead.
138 203 */
139 204 function json_decode(string $json, bool $assoc = \false, int $depth = 512, int $options = 0)
140 205 {
141 - return \YoastSEO_Vendor\GuzzleHttp\Utils::jsonDecode($json, $assoc, $depth, $options);
206 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use PHP\'s json_decode() instead.', __FUNCTION__);
207 + if ($depth < 1) {
208 + throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_decode error: Maximum stack depth exceeded');
209 + }
210 + $data = \json_decode($json, $assoc, $depth, $options);
211 + if (\JSON_ERROR_NONE !== \json_last_error()) {
212 + throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_decode error: ' . \json_last_error_msg());
213 + }
214 + /** @var object|array|string|int|float|bool|null $data */
215 + return $data;
142 216 }
143 217 /**
144 218 * Wrapper for JSON encoding that throws when an error occurs.
145 219 *
@@ -149,10 +223,17 @@
149 223 *
150 224 * @throws Exception\InvalidArgumentException if the JSON cannot be encoded.
151 225 *
152 226 * @see https://www.php.net/manual/en/function.json-encode.php
153 - * @deprecated json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonEncode instead.
227 + * @deprecated json_encode will be removed in guzzlehttp/guzzle:8.0. Use PHP's json_encode() instead.
154 228 */
155 229 function json_encode($value, int $options = 0, int $depth = 512) : string
156 230 {
157 - return \YoastSEO_Vendor\GuzzleHttp\Utils::jsonEncode($value, $options, $depth);
231 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use PHP\'s json_encode() instead.', __FUNCTION__);
232 + /** @var positive-int $depth */
233 + $json = \json_encode($value, $options, $depth);
234 + if (\JSON_ERROR_NONE !== \json_last_error()) {
235 + throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_encode error: ' . \json_last_error_msg());
236 + }
237 + /** @var non-empty-string $json */
238 + return $json;
158 239 }