| 1 |
<?php |
| 2 |
/** |
| 3 |
* Polyfills for functions accidentally prefixed in vendored dependencies. |
| 4 |
* |
| 5 |
* The authoritative fix lives in php-scoper/scoper.inc.php (exclude-functions), |
| 6 |
* which stops the scoper from prefixing these calls in the first place. This |
| 7 |
* shim only protects sites still running a vendor_prefixed build produced |
| 8 |
* before that fix; do not add new symbols here — exclude them in the scoper |
| 9 |
* config instead. |
| 10 |
* |
| 11 |
* @package WCPOS\Vendor |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace WCPOS\Vendor; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound -- matches prefixed vendor namespace. |
| 15 |
|
| 16 |
if ( ! \function_exists( __NAMESPACE__ . '\\http_get_last_response_headers' ) ) { |
| 17 |
/** |
| 18 |
* Proxy PHP's response-header helper for prefixed vendor code. |
| 19 |
* |
| 20 |
* @return array<int, string> |
| 21 |
*/ |
| 22 |
function http_get_last_response_headers(): array { |
| 23 |
if ( \function_exists( 'http_get_last_response_headers' ) ) { |
| 24 |
$headers = \http_get_last_response_headers(); |
| 25 |
|
| 26 |
return \is_array( $headers ) ? $headers : array(); |
| 27 |
} |
| 28 |
|
| 29 |
return array(); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
if ( ! \function_exists( __NAMESPACE__ . '\\http_clear_last_response_headers' ) ) { |
| 34 |
/** |
| 35 |
* Proxy PHP's response-header reset helper for prefixed vendor code. |
| 36 |
*/ |
| 37 |
function http_clear_last_response_headers(): void { |
| 38 |
if ( \function_exists( 'http_clear_last_response_headers' ) ) { |
| 39 |
\http_clear_last_response_headers(); |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|