mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Ensure preg does not output empty array elements.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -24,7 +24,7 @@ if(in_array($list, $check_lists)) {
|
||||
}
|
||||
|
||||
// Split individual domains into array
|
||||
$domains = preg_split('/\s+/', $_POST['domain']);
|
||||
$domains = preg_split('/\s+/', $_POST['domain'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
require_once("func.php");
|
||||
require_once("database.php");
|
||||
|
||||
@@ -85,10 +85,6 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false)
|
||||
$num = 0;
|
||||
foreach($domains as $domain)
|
||||
{
|
||||
// Skip empty domains
|
||||
if(strlen($domain) == 0)
|
||||
continue;
|
||||
|
||||
if($wildcardstyle)
|
||||
$domain = "(\\.|^)".str_replace(".","\\.",$domain)."$";
|
||||
|
||||
@@ -132,10 +128,6 @@ function remove_from_table($db, $table, $domains)
|
||||
$num = 0;
|
||||
foreach($domains as $domain)
|
||||
{
|
||||
// Skip empty domains
|
||||
if(strlen($domain) == 0)
|
||||
continue;
|
||||
|
||||
$stmt->bindValue(":domain", $domain, SQLITE3_TEXT);
|
||||
|
||||
if($stmt->execute() && $stmt->reset())
|
||||
|
||||
@@ -17,7 +17,7 @@ if (empty($api)) {
|
||||
}
|
||||
|
||||
// Split individual domains into array
|
||||
$domains = preg_split('/\s+/', $_POST['domain']);
|
||||
$domains = preg_split('/\s+/', $_POST['domain'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
require_once("func.php");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user