Project

General

Profile

« Previous | Next » 

Revision 8c81cad5

Added by Marcos M 10 months ago

Filter out empty array values for explode()

Calling explode() with an empty string will return a single-element
array with an empty value. This change filters out empty values
where appropriate - i.e. where it's not already a condition check for
it and the value should not be empty.

View differences:

src/etc/inc/ipsec.auth-user.php
38 38
openlog("charon", LOG_ODELAY, LOG_AUTH);
39 39

  
40 40
if (isset($_GET['username'])) {
41
	$authmodes = explode(",", $_GET['authcfg']);
41
	$authmodes = array_filter(explode(",", $_GET['authcfg']));
42 42
	$username = $_GET['username'];
43 43
	$password = $_GET['password'];
44 44
	$common_name = $_GET['cn'];
......
47 47
	$username = getenv("username");
48 48
	$password = getenv("password");
49 49
	$common_name = getenv("common_name");
50
	$authmodes = explode(",", getenv("authcfg"));
50
	$authmodes = array_filter(explode(",", getenv("authcfg")));
51 51
}
52 52

  
53 53
if (!$username) {

Also available in: Unified diff