diff --git a/main/document/edit_document.php b/main/document/edit_document.php index 8c2ef6cf99..ae91fd625a 100644 --- a/main/document/edit_document.php +++ b/main/document/edit_document.php @@ -1,4 +1,4 @@ -can not open file'); // search and store occurences of the tag in an array - - $buffer = fread( $fp, filesize($htmlFile) ) or die('
can not read file
');; - + $size_file=(filesize($htmlFile)===0) ? 1 : filesize($htmlFile); + if (isset($fp) && !($fp===false)) { + $buffer = fread( $fp, $size_file ); + if (strlen($buffer)>=0 && !($buffer===false)) { + // + } else { + die('
can not read file
'); + } + } else { + die('
can not read file
'); + } $matches = array(); if ( preg_match_all('~<[[:space:]]*img[^>]*>~i', $buffer, $matches) ) {