PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/contact-segmentation/libraries/mobile-detect.php +11 -4 1.3.22.7.0 View file →
@@ -879,15 +879,15 @@
879 879
880 880 /**
881 881 * Construct an instance of this class.
882 882 *
883 - * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored.
883 + * @param array|null $headers Specify the headers as injection. Should be PHP _SERVER flavored.
884 884 * If left empty, will use the global _SERVER['HTTP_*'] vars instead.
885 885 * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT
886 886 * from the $headers array instead.
887 887 */
888 888 public function __construct(
889 - array $headers = null,
889 + ?array $headers = null,
890 890 $userAgent = null
891 891 ) {
892 892 $this->setHttpHeaders($headers);
893 893 $this->setUserAgent($userAgent);
@@ -1287,9 +1287,14 @@
1287 1287 public function __call($name, $arguments)
1288 1288 {
1289 1289 // make sure the name starts with 'is', otherwise
1290 1290 if (substr($name, 0, 2) !== 'is') {
1291 - throw new BadMethodCallException("No such method exists: $name");
1291 + $error_message = sprintf(
1292 + "No such method exists: %s",
1293 + esc_html( $name )
1294 + );
1295 +
1296 + throw new BadMethodCallException( esc_html( $error_message ) );
1292 1297 }
1293 1298
1294 1299 $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
1295 1300
@@ -1457,9 +1462,11 @@
1457 1462 * @todo: search in the HTTP headers too.
1458 1463 */
1459 1464 public function match($regex, $userAgent = null)
1460 1465 {
1461 - $match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches);
1466 + $subject = (string) ($userAgent ?? $this->userAgent);
1467 + $match = (bool) preg_match(sprintf('#%s#is', $regex), $subject, $matches);
1468 +
1462 1469 // If positive match is found, store the results for debug.
1463 1470 if ($match) {
1464 1471 $this->matchingRegex = $regex;
1465 1472 $this->matchesArray = $matches;