From dc4a4eb00d67d7d28fae137437900220920577d4 Mon Sep 17 00:00:00 2001 From: Patrick Brown Date: Fri, 29 May 2015 15:38:43 -0400 Subject: Abort io_replaceInLine when the search parameter is empty --- inc/io.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc') diff --git a/inc/io.php b/inc/io.php index 4c7fb094f..6d3c20047 100644 --- a/inc/io.php +++ b/inc/io.php @@ -298,6 +298,11 @@ function io_saveFile($file, $content, $append=false) { * @return bool true on success */ function io_replaceInFile($file, $oldline, $newline, $regex=false, $maxlines=0) { + if ((string)$oldline === '') { + trigger_error('$oldline parameter cannot be empty in io_replaceInFile()', E_USER_WARNING); + return false; + } + if (!file_exists($file)) return true; io_lock($file); -- cgit v1.2.3