diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2016-06-26 10:33:27 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2016-06-26 13:31:34 +0200 |
commit | 264ca54e406eee7c01b01f748aabd4a29e9c4872 (patch) | |
tree | c058e72d70339e2aa1a9aaa656d86e47b6f6dc96 | |
parent | 332a64d0c8a6486d40c6295351ca3068a77a216a (diff) | |
download | pfsense-264ca54e406eee7c01b01f748aabd4a29e9c4872.zip pfsense-264ca54e406eee7c01b01f748aabd4a29e9c4872.tar.gz |
simplify DHCP_Config_Option_Split, no loop needed for returning option array
-rw-r--r-- | src/etc/inc/interfaces.inc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 7816298..c97bd72 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4364,12 +4364,8 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) { } function DHCP_Config_Option_Split($option_string) { - $options = []; - preg_match_all('/[^",]*(?:"[^"]*"[^",]*)+(?:"[^",]*)?|[^,]+/m', $option_string, $result, PREG_PATTERN_ORDER); - for ($i = 0; $i < count($result[0]); $i++) { - $options[] = $result[0][$i]; - } - return $options; + preg_match_all('/[^",]*(?:"[^"]*"[^",]*)+(?:"[^",]*)?|[^,]+/m', $option_string, $matches, PREG_PATTERN_ORDER); + return $matches ? $matches[0] : []; } function DHCP_Config_File_Override($wancfg, $wanif) { |