Issues (1378)

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/acf/admin/views/field-group-locations.php (4 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
// vars
4
$rule_types = apply_filters('acf/location/rule_types', array(
5
	__("Post",'acf') => array(
6
		'post_type'		=>	__("Post Type",'acf'),
7
		'post_status'	=>	__("Post Status",'acf'),
8
		'post_format'	=>	__("Post Format",'acf'),
9
		'post_category'	=>	__("Post Category",'acf'),
10
		'post_taxonomy'	=>	__("Post Taxonomy",'acf'),
11
		'post'			=>	__("Post",'acf')
12
	),
13
	__("Page",'acf') => array(
14
		'page_template'	=>	__("Page Template",'acf'),
15
		'page_type'		=>	__("Page Type",'acf'),
16
		'page_parent'	=>	__("Page Parent",'acf'),
17
		'page'			=>	__("Page",'acf')
18
	),
19
	__("User",'acf') => array(
20
		'current_user'		=>	__("Current User",'acf'),
21
		'current_user_role'	=>	__("Current User Role",'acf'),
22
		'user_form'			=>	__("User Form",'acf'),
23
		'user_role'			=>	__("User Role",'acf')
24
	),
25
	__("Forms",'acf') => array(
26
		'attachment'	=>	__("Attachment",'acf'),
27
		'taxonomy'		=>	__("Taxonomy Term",'acf'),
28
		'comment'		=>	__("Comment",'acf'),
29
		'widget'		=>	__("Widget",'acf')
30
	)
31
));
32
33
$rule_operators = apply_filters( 'acf/location/rule_operators', array(
34
	'=='	=>	__("is equal to",'acf'),
35
	'!='	=>	__("is not equal to",'acf'),
36
));
37
						
38
?>
39
<div class="acf-field">
40
	<div class="acf-label">
41
		<label><?php _e("Rules",'acf'); ?></label>
42
		<p><?php _e("Create a set of rules to determine which edit screens will use these advanced custom fields",'acf'); ?></p>
43
	</div>
44
	<div class="acf-input">
45
		<div class="rule-groups">
46
			
47
			<?php foreach( $field_group['location'] as $group_id => $group ): 
48
				
49
				// validate
50
				if( empty($group) ) {
51
				
52
					continue;
53
					
54
				}
55
				
56
				
57
				// $group_id must be completely different to $rule_id to avoid JS issues
58
				$group_id = "group_{$group_id}";
59
				$h4 = ($group_id == "group_0") ? __("Show this field group if",'acf') : __("or",'acf');
60
				
61
				?>
62
			
63
				<div class="rule-group" data-id="<?php echo $group_id; ?>">
64
				
65
					<h4><?php echo $h4; ?></h4>
66
					
67
					<table class="acf-table -clear">
68
						<tbody>
69
							<?php foreach( $group as $rule_id => $rule ): 
70
								
71
								// valid rule
72
								$rule = wp_parse_args( $rule, array(
73
									'field'		=>	'',
74
									'operator'	=>	'==',
75
									'value'		=>	'',
76
								));
77
								
78
															
79
								// $group_id must be completely different to $rule_id to avoid JS issues
80
								$rule_id = "rule_{$rule_id}";
81
								
82
								?>
83
								<tr data-id="<?php echo $rule_id; ?>">
84
								<td class="param"><?php 
85
									
86
									// create field
87
									acf_render_field(array(
0 ignored issues
show
array('type' => 'select'... 'location-rule-param') is of type array<string,?,{"type":"...:"?","class":"string"}>, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
88
										'type'		=> 'select',
89
										'prefix'	=> "acf_field_group[location][{$group_id}][{$rule_id}]",
90
										'name'		=> 'param',
91
										'value'		=> $rule['param'],
92
										'choices'	=> $rule_types,
93
										'class'		=> 'location-rule-param'
94
									));
95
		
96
								?></td>
97
								<td class="operator"><?php 	
0 ignored issues
show
There is some trailing whitespace on this line which should be avoided as per coding-style.
Loading history...
98
									
99
									// create field
100
									acf_render_field(array(
0 ignored issues
show
array('type' => 'select'...ocation-rule-operator') is of type array<string,?,{"type":"...:"?","class":"string"}>, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
101
										'type'		=> 'select',
102
										'prefix'	=> "acf_field_group[location][{$group_id}][{$rule_id}]",
103
										'name'		=> 'operator',
104
										'value'		=> $rule['operator'],
105
										'choices' 	=> $rule_operators,
106
										'class'		=> 'location-rule-operator'
107
									)); 	
0 ignored issues
show
There is some trailing whitespace on this line which should be avoided as per coding-style.
Loading history...
108
									
109
								?></td>
110
								<td class="value"><?php 
111
									
112
									$this->render_location_value(array(
113
										'group_id'	=> $group_id,
114
										'rule_id'	=> $rule_id,
115
										'value'		=> $rule['value'],
116
										'param'		=> $rule['param'],
117
										'class'		=> 'location-rule-value'
118
									)); 
119
									
120
								?></td>
121
								<td class="add">
122
									<a href="#" class="acf-button add-location-rule"><?php _e("and",'acf'); ?></a>
123
								</td>
124
								<td class="remove">
125
									<a href="#" class="acf-icon -minus remove-location-rule"></a>
126
								</td>
127
								</tr>
128
							<?php endforeach; ?>
129
						</tbody>
130
					</table>
131
					
132
				</div>
133
			<?php endforeach; ?>
134
			
135
			<h4><?php _e("or",'acf'); ?></h4>
136
			
137
			<a href="#" class="acf-button add-location-group"><?php _e("Add rule group",'acf'); ?></a>
138
			
139
		</div>
140
	</div>
141
</div>
142
<script type="text/javascript">
143
if( typeof acf !== 'undefined' ) {
144
		
145
	acf.postbox.render({
146
		'id': 'acf-field-group-locations',
147
		'label': 'left'
148
	});	
149
150
}
151
</script>
152