From eca6c5ae2f863792d9f09ea1cd1832a78c374fd6 Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 20 Nov 2020 07:32:52 +0000 Subject: [PATCH] Bugfix: set preg_replace limit --- includes/hostapd.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 757b44e8..30883f48 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -383,8 +383,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) } $config = join(PHP_EOL, $config); $dhcp_cfg = file_get_contents(RASPI_DHCPCD_CONFIG); - $merged = preg_replace('/^#\sRaspAP\s.*?(?=\s*^\s*$)/ms', $config, $dhcp_cfg); - file_put_contents("/tmp/dhcpddata", rtrim($merged).PHP_EOL); + $config = preg_replace('/^#\sRaspAP\s.*?(?=\s*^\s*$)/ms', $config, $dhcp_cfg, 1); + file_put_contents("/tmp/dhcpddata", $config); system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return); if ($return == 0) {