Skip to content

Commit d7e6e8b

Browse files
author
Nicholas Pisarro
committed
fix: if passed a string filled with nothing but symbol characters, would result in "Invalid argument supplied for foreach()" errors in two places
git-svn-id: http://svn.php.net/repository/pear/packages/Text_LanguageDetect/trunk@208964 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 151e9a4 commit d7e6e8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Text/LanguageDetect/Parser.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ function analyze()
231231
}
232232

233233
$skipped_count = 0;
234+
$unicode_chars = array();
234235
}
235236

236237
// trigram startup
@@ -343,7 +344,11 @@ function analyze()
343344
}
344345
}
345346

346-
$this->_trigram_ranks = $this->_arr_rank($this->_trigram);
347+
if (!empty($this->_trigram)) {
348+
$this->_trigram_ranks = $this->_arr_rank($this->_trigram);
349+
} else {
350+
$this->_trigram_ranks = array();
351+
}
347352
}
348353
}
349354
}

0 commit comments

Comments
 (0)