PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260917
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260917
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
← All changes | src/includes/classes/utils-strings.inc.php +25 -6 260805260917 View file →
@@ -71,9 +71,14 @@
71 71 '&#0*8220;' => '“',
72 72 '&#[xX]0*201[cC];' => '“',
73 73 '”' => '”',
74 74 '&#0*8221;' => '”',
75 - '&#[xX]0*201[dD];' => '”'
75 + '&#[xX]0*201[dD];' => '”',
76 + //260829.0025 Literal smart quotes can reach shortcode attributes unchanged; normalize them like their HTML entity forms.
77 + '‘' => '‘',
78 + '’' => '’',
79 + '“' => '“',
80 + '”' => '”'
76 81 );
77 82
78 83 /**
79 84 * Escapes double quotes.
@@ -574,15 +579,29 @@
574 579
575 580 if(empty($signature) && stripos(PHP_OS, 'win') === 0 && file_exists(($openssl = 'c:\\openssl-win64\\bin\\openssl.exe')))
576 581 $signature = c_ws_plugin__s2member_utils_strings::_rsa_sha1_shell_sign((string)$string, (string)$key, $openssl);
577 582
578 - if(empty($signature) && function_exists('openssl_get_privatekey') && function_exists('openssl_sign') && is_resource($private_key = openssl_get_privatekey((string)$key)))
579 - openssl_sign((string)$string, $signature, $private_key, OPENSSL_ALGO_SHA1).openssl_free_key($private_key);
583 + //260816 PHP 8 returns OpenSSLAsymmetricKey objects instead of resources; false indicates key-loading failure on all supported PHP versions.
584 + if(empty($signature) && function_exists('openssl_get_privatekey') && function_exists('openssl_sign') && ($private_key = openssl_get_privatekey((string)$key)) !== FALSE)
585 + {
586 + openssl_sign((string)$string, $signature, $private_key, OPENSSL_ALGO_SHA1);
587 + //260816 openssl_free_key() is unnecessary on PHP 8+ and deprecated there; PHP 5-7 still use resource cleanup.
588 + if(PHP_VERSION_ID < 80000 && is_resource($private_key))
589 + openssl_free_key($private_key);
590 + }
580 591
581 592 if(empty($signature)) // Now, if we're still empty, trigger an error here.
582 - trigger_error('s2Member was unable to generate an RSA-SHA1 signature.'.
583 - ' Please make sure your installation of PHP is compiled with OpenSSL: `openssl_sign()`.'.
584 - ' See: http://php.net/manual/en/function.openssl-sign.php', E_USER_ERROR);
593 + {
594 + $error = 's2Member was unable to generate an RSA-SHA1 signature.'.
595 + ' Please make sure your installation of PHP is compiled with OpenSSL: `openssl_sign()`.'.
596 + ' See: http://php.net/manual/en/function.openssl-sign.php';
597 +
598 + //260816 PHP 8.4 deprecates trigger_error(..., E_USER_ERROR); preserve the previous fatal-style path on older PHP.
599 + if(PHP_VERSION_ID >= 80400)
600 + throw new \RuntimeException($error);
601 + else
602 + trigger_error($error, E_USER_ERROR);
603 + }
585 604
586 605 return (!empty($signature)) ? $signature : FALSE;
587 606 }
588 607