diff options
author | Patrick Brown <ptbrown@whoopdedo.org> | 2015-05-29 15:38:43 -0400 |
---|---|---|
committer | Patrick Brown <ptbrown@whoopdedo.org> | 2015-05-29 15:38:43 -0400 |
commit | dc4a4eb00d67d7d28fae137437900220920577d4 (patch) | |
tree | 677ad6c67fe0a95b8022bf0f1765701ca77950d0 /inc | |
parent | e12c5ac781d560502d478775502df70cd80472de (diff) | |
download | rpg-dc4a4eb00d67d7d28fae137437900220920577d4.tar.gz rpg-dc4a4eb00d67d7d28fae137437900220920577d4.tar.bz2 |
Abort io_replaceInLine when the search parameter is empty
Diffstat (limited to 'inc')
-rw-r--r-- | inc/io.php | 5 |
1 files changed, 5 insertions, 0 deletions
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); |