Fix PHP notice "Undefined offset: 1 in readme-parser.php on line 124".

The for loop was iterating including the count index of the $_sections, it should be excluding
This commit is contained in:
Adrien Foulon 2018-09-23 16:47:42 +02:00 committed by GitHub
parent c9a7d2a7da
commit 89e8849957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ class PucReadmeParser {
$_sections = preg_split('/^[\s]*==[\s]*(.+?)[\s]*==/m', $file_contents, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$sections = array();
for ( $i=1; $i <= count($_sections); $i +=2 ) {
for ( $i=1; $i < count($_sections); $i +=2 ) {
$_sections[$i] = preg_replace('/(^[\s]*)=[\s]+(.+?)[\s]+=/m', '$1<h4>$2</h4>', $_sections[$i]);
$_sections[$i] = $this->filter_text( $_sections[$i], true );
$title = $this->sanitize_text( $_sections[$i-1] );
@ -334,4 +334,4 @@ class PucReadmeParser {
} // end class
endif;
endif;