Issues (4967)

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.

src/wp-includes/default-constants.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
 * Defines constants and global variables that can be overridden, generally in wp-config.php.
4
 *
5
 * @package WordPress
6
 */
7
8
/**
9
 * Defines initial WordPress constants
10
 *
11
 * @see wp_debug_mode()
12
 *
13
 * @since 3.0.0
14
 *
15
 * @global int $blog_id
16
 */
17
function wp_initial_constants() {
18
	global $blog_id;
19
20
	/**#@+
21
	 * Constants for expressing human-readable data sizes in their respective number of bytes.
22
	 *
23
	 * @since 4.4.0
24
	 */
25
	define( 'KB_IN_BYTES', 1024 );
26
	define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
27
	define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
28
	define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
29
	/**#@-*/
30
31
	$current_limit     = @ini_get( 'memory_limit' );
32
	$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
33
34
	// Define memory limits.
35
	if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
36
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
37
			define( 'WP_MEMORY_LIMIT', $current_limit );
38
		} elseif ( is_multisite() ) {
39
			define( 'WP_MEMORY_LIMIT', '64M' );
40
		} else {
41
			define( 'WP_MEMORY_LIMIT', '40M' );
42
		}
43
	}
44
45
	if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
46
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
47
			define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
48
		} elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
49
			define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
50
		} else {
51
			define( 'WP_MAX_MEMORY_LIMIT', '256M' );
52
		}
53
	}
54
55
	// Set memory limits.
56
	$wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
57
	if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) {
58
		@ini_set( 'memory_limit', WP_MEMORY_LIMIT );
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
59
	}
60
61
	if ( ! isset($blog_id) )
62
		$blog_id = 1;
63
64
	if ( !defined('WP_CONTENT_DIR') )
65
		define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
66
67
	// Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
68
	if ( !defined('WP_DEBUG') )
69
		define( 'WP_DEBUG', false );
70
71
	// Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for
72
	// display_errors and not force errors to be displayed. Use false to force display_errors off.
73
	if ( !defined('WP_DEBUG_DISPLAY') )
74
		define( 'WP_DEBUG_DISPLAY', true );
75
76
	// Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
77
	if ( !defined('WP_DEBUG_LOG') )
78
		define('WP_DEBUG_LOG', false);
79
80
	if ( !defined('WP_CACHE') )
81
		define('WP_CACHE', false);
82
83
	// Add define('SCRIPT_DEBUG', true); to wp-config.php to enable loading of non-minified,
84
	// non-concatenated scripts and stylesheets.
85
	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
86
		if ( ! empty( $GLOBALS['wp_version'] ) ) {
87
			$develop_src = false !== strpos( $GLOBALS['wp_version'], '-src' );
88
		} else {
89
			$develop_src = false;
90
		}
91
92
		define( 'SCRIPT_DEBUG', $develop_src );
93
	}
94
95
	/**
96
	 * Private
97
	 */
98
	if ( !defined('MEDIA_TRASH') )
99
		define('MEDIA_TRASH', false);
100
101
	if ( !defined('SHORTINIT') )
102
		define('SHORTINIT', false);
103
104
	// Constants for features added to WP that should short-circuit their plugin implementations
105
	define( 'WP_FEATURE_BETTER_PASSWORDS', true );
106
107
	/**#@+
108
	 * Constants for expressing human-readable intervals
109
	 * in their respective number of seconds.
110
	 *
111
	 * Please note that these values are approximate and are provided for convenience.
112
	 * For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
113
	 * YEAR_IN_SECONDS does not take leap years into account.
114
	 *
115
	 * If you need more accuracy please consider using the DateTime class (https://secure.php.net/manual/en/class.datetime.php).
116
	 *
117
	 * @since 3.5.0
118
	 * @since 4.4.0 Introduced `MONTH_IN_SECONDS`.
119
	 */
120
	define( 'MINUTE_IN_SECONDS', 60 );
121
	define( 'HOUR_IN_SECONDS',   60 * MINUTE_IN_SECONDS );
122
	define( 'DAY_IN_SECONDS',    24 * HOUR_IN_SECONDS   );
123
	define( 'WEEK_IN_SECONDS',    7 * DAY_IN_SECONDS    );
124
	define( 'MONTH_IN_SECONDS',  30 * DAY_IN_SECONDS    );
125
	define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    );
126
	/**#@-*/
127
}
128
129
/**
130
 * Defines plugin directory WordPress constants
131
 *
132
 * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in
133
 *
134
 * @since 3.0.0
135
 */
136
function wp_plugin_directory_constants() {
137
	if ( !defined('WP_CONTENT_URL') )
138
		define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
139
140
	/**
141
	 * Allows for the plugins directory to be moved from the default location.
142
	 *
143
	 * @since 2.6.0
144
	 */
145
	if ( !defined('WP_PLUGIN_DIR') )
146
		define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
147
148
	/**
149
	 * Allows for the plugins directory to be moved from the default location.
150
	 *
151
	 * @since 2.6.0
152
	 */
153
	if ( !defined('WP_PLUGIN_URL') )
154
		define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
155
156
	/**
157
	 * Allows for the plugins directory to be moved from the default location.
158
	 *
159
	 * @since 2.1.0
160
	 * @deprecated
161
	 */
162
	if ( !defined('PLUGINDIR') )
163
		define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
164
165
	/**
166
	 * Allows for the mu-plugins directory to be moved from the default location.
167
	 *
168
	 * @since 2.8.0
169
	 */
170
	if ( !defined('WPMU_PLUGIN_DIR') )
171
		define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
172
173
	/**
174
	 * Allows for the mu-plugins directory to be moved from the default location.
175
	 *
176
	 * @since 2.8.0
177
	 */
178
	if ( !defined('WPMU_PLUGIN_URL') )
179
		define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
180
181
	/**
182
	 * Allows for the mu-plugins directory to be moved from the default location.
183
	 *
184
	 * @since 2.8.0
185
	 * @deprecated
186
	 */
187
	if ( !defined( 'MUPLUGINDIR' ) )
188
		define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
189
}
190
191
/**
192
 * Defines cookie related WordPress constants
193
 *
194
 * Defines constants after multisite is loaded.
195
 * @since 3.0.0
196
 */
197
function wp_cookie_constants() {
198
	/**
199
	 * Used to guarantee unique hash cookies
200
	 *
201
	 * @since 1.5.0
202
	 */
203
	if ( !defined( 'COOKIEHASH' ) ) {
204
		$siteurl = get_site_option( 'siteurl' );
205
		if ( $siteurl )
206
			define( 'COOKIEHASH', md5( $siteurl ) );
207
		else
208
			define( 'COOKIEHASH', '' );
209
	}
210
211
	/**
212
	 * @since 2.0.0
213
	 */
214
	if ( !defined('USER_COOKIE') )
215
		define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
216
217
	/**
218
	 * @since 2.0.0
219
	 */
220
	if ( !defined('PASS_COOKIE') )
221
		define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
222
223
	/**
224
	 * @since 2.5.0
225
	 */
226
	if ( !defined('AUTH_COOKIE') )
227
		define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
228
229
	/**
230
	 * @since 2.6.0
231
	 */
232
	if ( !defined('SECURE_AUTH_COOKIE') )
233
		define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
234
235
	/**
236
	 * @since 2.6.0
237
	 */
238
	if ( !defined('LOGGED_IN_COOKIE') )
239
		define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
240
241
	/**
242
	 * @since 2.3.0
243
	 */
244
	if ( !defined('TEST_COOKIE') )
245
		define('TEST_COOKIE', 'wordpress_test_cookie');
246
247
	/**
248
	 * @since 1.2.0
249
	 */
250
	if ( !defined('COOKIEPATH') )
251
		define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
252
253
	/**
254
	 * @since 1.5.0
255
	 */
256
	if ( !defined('SITECOOKIEPATH') )
257
		define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
258
259
	/**
260
	 * @since 2.6.0
261
	 */
262
	if ( !defined('ADMIN_COOKIE_PATH') )
263
		define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
264
265
	/**
266
	 * @since 2.6.0
267
	 */
268
	if ( !defined('PLUGINS_COOKIE_PATH') )
269
		define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
270
271
	/**
272
	 * @since 2.0.0
273
	 */
274
	if ( !defined('COOKIE_DOMAIN') )
275
		define('COOKIE_DOMAIN', false);
276
}
277
278
/**
279
 * Defines cookie related WordPress constants
280
 *
281
 * @since 3.0.0
282
 */
283
function wp_ssl_constants() {
284
	/**
285
	 * @since 2.6.0
286
	 */
287
	if ( !defined( 'FORCE_SSL_ADMIN' ) ) {
288
		if ( 'https' === parse_url( get_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
289
			define( 'FORCE_SSL_ADMIN', true );
290
		} else {
291
			define( 'FORCE_SSL_ADMIN', false );
292
		}
293
	}
294
	force_ssl_admin( FORCE_SSL_ADMIN );
295
296
	/**
297
	 * @since 2.6.0
298
	 * @deprecated 4.0.0
299
	 */
300
	if ( defined( 'FORCE_SSL_LOGIN' ) && FORCE_SSL_LOGIN ) {
301
		force_ssl_admin( true );
302
	}
303
}
304
305
/**
306
 * Defines functionality related WordPress constants
307
 *
308
 * @since 3.0.0
309
 */
310
function wp_functionality_constants() {
311
	/**
312
	 * @since 2.5.0
313
	 */
314
	if ( !defined( 'AUTOSAVE_INTERVAL' ) )
315
		define( 'AUTOSAVE_INTERVAL', 60 );
316
317
	/**
318
	 * @since 2.9.0
319
	 */
320
	if ( !defined( 'EMPTY_TRASH_DAYS' ) )
321
		define( 'EMPTY_TRASH_DAYS', 30 );
322
323
	if ( !defined('WP_POST_REVISIONS') )
324
		define('WP_POST_REVISIONS', true);
325
326
	/**
327
	 * @since 3.3.0
328
	 */
329
	if ( !defined( 'WP_CRON_LOCK_TIMEOUT' ) )
330
		define('WP_CRON_LOCK_TIMEOUT', 60);  // In seconds
331
}
332
333
/**
334
 * Defines templating related WordPress constants
335
 *
336
 * @since 3.0.0
337
 */
338
function wp_templating_constants() {
339
	/**
340
	 * Filesystem path to the current active template directory
341
	 * @since 1.5.0
342
	 */
343
	define('TEMPLATEPATH', get_template_directory());
344
345
	/**
346
	 * Filesystem path to the current active template stylesheet directory
347
	 * @since 2.1.0
348
	 */
349
	define('STYLESHEETPATH', get_stylesheet_directory());
350
351
	/**
352
	 * Slug of the default theme for this install.
353
	 * Used as the default theme when installing new sites.
354
	 * It will be used as the fallback if the current theme doesn't exist.
355
	 *
356
	 * @since 3.0.0
357
	 * @see WP_Theme::get_core_default_theme()
358
	 */
359
	if ( !defined('WP_DEFAULT_THEME') )
360
		define( 'WP_DEFAULT_THEME', 'twentyseventeen' );
361
362
}
363