banbuilder icon indicating copy to clipboard operation
banbuilder copied to clipboard

Maximum execution time of 30 seconds exceeded

Open stefanoortisi opened this issue 9 years ago • 1 comments

I'm using banbuilder in my Laravel 5 app. When I try to run the censorString method I get the following error:

FatalErrorException in CensorWords.php line 181: Maximum execution time of 30 seconds exceeded

This is the code generating the error:

Validator::extend('filter_bad_words', function($attribute, $text, $parameters) {            

  $censor = new \Snipe\BanBuilder\CensorWords;
  $langs = array('it');
  $badwords = $censor->setDictionary($langs);
  $string = $censor->censorString($text);

  return sizeof( $string[ 'matched' ] ) <= 0;
});

Is the only solution increase the maximum execution time allowed?

stefanoortisi avatar Feb 12 '16 09:02 stefanoortisi

I found the problem: if I run PHP 7.0 the scripts doesn't complete and gets the maximum execution time error. If I run PHP <= 5.6, the scripts does work fine.

stefanoortisi avatar Feb 12 '16 15:02 stefanoortisi