Issues (1182)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/class-wc-shipping-rate.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if ( ! defined( 'ABSPATH' ) ) {
4
	exit; // Exit if accessed directly
5
}
6
7
/**
8
 * WooCommerce Shipping Rate Class.
9
 *
10
 * Simple Class for storing rates.
11
 *
12
 * @class 		WC_Shipping_Rate
13
 * @version		2.6.0
14
 * @package		WooCommerce/Classes/Shipping
15
 * @category	Class
16
 * @author 		WooThemes
17
 */
18
class WC_Shipping_Rate {
19
20
	/** @var string Rate ID. */
21
	public $id        = '';
22
23
	/** @var string Label for the rate. */
24
	public $label     = '';
25
26
	/** @var float Cost for the rate. */
27
	public $cost      = 0;
28
29
	/** @var array Array of taxes for the rate. */
30
	public $taxes     = array();
31
32
	/** @var string Label for the rate. */
33
	public $method_id = '';
34
35
	/**
36
	 * Stores meta data for this rate
37
	 * @since 2.6.0
38
	 * @var array
39
	 */
40
	private $meta_data = array();
41
42
	/**
43
	 * Constructor.
44
	 *
45
	 * @param string $id
46
	 * @param string $label
47
	 * @param integer $cost
48
	 * @param array $taxes
49
	 * @param string $method_id
50
	 */
51
	public function __construct( $id = '', $label = '', $cost = 0, $taxes = array(), $method_id = '' ) {
52
		$this->id        = $id;
53
		$this->label     = $label;
54
		$this->cost      = $cost;
0 ignored issues
show
Documentation Bug introduced by
The property $cost was declared of type double, but $cost is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
55
		$this->taxes     = ! empty( $taxes ) && is_array( $taxes ) ? $taxes : array();
56
		$this->method_id = $method_id;
57
	}
58
59
	/**
60
	 * Get shipping tax.
61
	 *
62
	 * @return array
63
	 */
64
	public function get_shipping_tax() {
65
		return apply_filters( 'woocommerce_get_shipping_tax', sizeof( $this->taxes ) > 0 && ! WC()->customer->is_vat_exempt() ? array_sum( $this->taxes ) : 0, $this );
66
	}
67
68
	/**
69
	 * Get label.
70
	 *
71
	 * @return string
72
	 */
73
	public function get_label() {
74
		return apply_filters( 'woocommerce_shipping_rate_label', $this->label );
75
	}
76
77
	/**
78
	 * Add some meta data for this rate.
79
	 * @since 2.6.0
80
	 * @param string $key
81
	 * @param string $value
82
	 */
83
	public function add_meta_data( $key, $value ) {
84
		$this->meta_data[ wc_clean( $key ) ] = wc_clean( $value );
85
	}
86
87
	/**
88
	 * Get all meta data for this rate.
89
	 * @since 2.6.0
90
	 */
91
	public function get_meta_data() {
92
		return $this->meta_data;
93
	}
94
}
95