Issues (4122)

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/widget/ComplexNamespaceInputWidget.php (8 issues)

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
 * MediaWiki Widgets – ComplexNamespaceInputWidget class.
4
 *
5
 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
6
 * @license The MIT License (MIT); see LICENSE.txt
7
 */
8
namespace MediaWiki\Widget;
9
10
/**
11
 * Namespace input widget. Displays a dropdown box with the choice of available namespaces, plus two
12
 * checkboxes to include associated namespace or to invert selection.
13
 */
14
class ComplexNamespaceInputWidget extends \OOUI\Widget {
15
16
	protected $config;
17
	protected $namespace;
18
	protected $associated = null;
19
	protected $associatedLabel = null;
20
	protected $invert = null;
21
	protected $invertLabel = null;
22
23
	/**
24
	 * @param array $config Configuration options
25
	 * @param array $config['namespace'] Configuration for the NamespaceInputWidget
0 ignored issues
show
There is no parameter named $config['namespace']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
26
	 *  dropdown with list of namespaces
27
	 * @param string $config['namespace']['includeAllValue'] If specified,
0 ignored issues
show
There is no parameter named $config['namespace']['includeAllValue']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
28
	 *  add an "all namespaces" option to the dropdown, and use this as the input value for it
29
	 * @param array|null $config['invert'] Configuration for the "invert selection"
0 ignored issues
show
There is no parameter named $config['invert']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
30
	 *  CheckboxInputWidget. If null, the checkbox will not be generated.
31
	 * @param array|null $config['associated'] Configuration for the "include associated namespace"
0 ignored issues
show
There is no parameter named $config['associated']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
32
	 *  CheckboxInputWidget. If null, the checkbox will not be generated.
33
	 * @param array $config['invertLabel'] Configuration for the FieldLayout with label
0 ignored issues
show
There is no parameter named $config['invertLabel']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
34
	 *  wrapping the "invert selection" checkbox
35
	 * @param string $config['invertLabel']['label'] Label text for the label
0 ignored issues
show
There is no parameter named $config['invertLabel']['label']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
36
	 * @param array $config['associatedLabel'] Configuration for the FieldLayout with label
0 ignored issues
show
There is no parameter named $config['associatedLabel']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
37
	 *  wrapping the "include associated namespace" checkbox
38
	 * @param string $config['associatedLabel']['label'] Label text for the label
0 ignored issues
show
There is no parameter named $config['associatedLabel']['label']. Did you maybe mean $config?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
39
	 */
40
	public function __construct( array $config = [] ) {
41
		// Configuration initialization
42
		$config = array_merge(
43
			[
44
				// Config options for nested widgets
45
				'namespace' => [],
46
				'invert' => [],
47
				'invertLabel' => [],
48
				'associated' => [],
49
				'associatedLabel' => [],
50
			],
51
			$config
52
		);
53
54
		// Parent constructor
55
		parent::__construct( $config );
56
57
		// Properties
58
		$this->config = $config;
59
60
		$this->namespace = new NamespaceInputWidget( $config['namespace'] );
61 View Code Duplication
		if ( $config['associated'] !== null ) {
62
			$this->associated = new \OOUI\CheckboxInputWidget( array_merge(
63
				[ 'value' => '1' ],
64
				$config['associated']
65
			) );
66
			// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
67
			$this->associatedLabel = new \OOUI\FieldLayout(
68
				$this->associated,
69
				array_merge(
70
					[ 'align' => 'inline' ],
71
					$config['associatedLabel']
72
				)
73
			);
74
		}
75 View Code Duplication
		if ( $config['invert'] !== null ) {
76
			$this->invert = new \OOUI\CheckboxInputWidget( array_merge(
77
				[ 'value' => '1' ],
78
				$config['invert']
79
			) );
80
			// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
81
			$this->invertLabel = new \OOUI\FieldLayout(
82
				$this->invert,
83
				array_merge(
84
					[ 'align' => 'inline' ],
85
					$config['invertLabel']
86
				)
87
			);
88
		}
89
90
		// Initialization
91
		$this
92
			->addClasses( [ 'mw-widget-complexNamespaceInputWidget' ] )
93
			->appendContent( $this->namespace, $this->associatedLabel, $this->invertLabel );
94
	}
95
96
	protected function getJavaScriptClassName() {
97
		return 'mw.widgets.ComplexNamespaceInputWidget';
98
	}
99
100
	public function getConfig( &$config ) {
101
		$config = array_merge(
102
			$config,
103
			array_intersect_key(
104
				$this->config,
105
				array_fill_keys(
106
					[
107
						'namespace',
108
						'invert',
109
						'invertLabel',
110
						'associated',
111
						'associatedLabel'
112
					],
113
					true
114
				)
115
			)
116
		);
117
		return parent::getConfig( $config );
118
	}
119
}
120