← All changes
|
src/includes/externals/aweber/oauth_application.php
+12
-1
260814
→
261001
View file →
| @@ -1,6 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | // @codingStandardsIgnoreFile |
| 3 | +if(!defined('WPINC')) //260928.0402 This OAuth library is only loaded through WordPress/s2Member; reject direct web requests. | |
| 4 | + exit('Do not access this file directly.'); | |
| 5 | + | |
| 3 | 6 | if (!class_exists('CurlObject')) require_once('curl_object.php'); |
| 4 | 7 | if (!class_exists('CurlResponse')) require_once('curl_response.php'); |
| 5 | 8 | |
| 6 | 9 | /** |
| @@ -54,8 +57,10 @@ | ||
| 54 | 57 | * |
| 55 | 58 | * @package |
| 56 | 59 | * @version $id$ |
| 57 | 60 | */ |
| 61 | +//260816 This legacy OAuth client intentionally uses dynamic state properties; opt in explicitly on PHP 8.2+. | |
| 62 | +#[\AllowDynamicProperties] | |
| 58 | 63 | class OAuthApplication implements AWeberOAuthAdapter { |
| 59 | 64 | public $debug = false; |
| 60 | 65 | |
| 61 | 66 | public $userAgent = 'AWeber OAuth Consumer Application 1.0 - https://labs.aweber.com/'; |
| @@ -310,9 +315,15 @@ | ||
| 310 | 315 | * @access protected |
| 311 | 316 | * @return void Encoded data |
| 312 | 317 | */ |
| 313 | 318 | protected function encode($data) { |
| 314 | - return rawurlencode(utf8_encode($data)); | |
| 319 | + //260816 Avoid utf8_encode() deprecations on PHP 8.2+ while preserving older fallbacks where possible. | |
| 320 | + if (function_exists('mb_convert_encoding')) { | |
| 321 | + $data = mb_convert_encoding($data, 'UTF-8', 'ISO-8859-1'); | |
| 322 | + } elseif (function_exists('iconv')) { | |
| 323 | + $data = iconv('ISO-8859-1', 'UTF-8', $data); | |
| 324 | + } | |
| 325 | + return rawurlencode($data); | |
| 315 | 326 | } |
| 316 | 327 | |
| 317 | 328 | /** |
| 318 | 329 | * createSignatureKey |