Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End strpos() [function.strpos]: Empty delimiter

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #145285
    Attila Hajzer
    Participant

    I’m getting that warning on this site : http://lottoholic.com/soccer/

    I’ve gone into the ftp and cheched the file and nothing seems to be out of order, i even compaired the file to another CBPress installment on another website, it’s the same file, same syntax, no error on the other site either. i’m thinking about copying and pasting the code from the one site to the next. but i don’t want to really mess things up. can someone give some advice?

    here’s the code block.

                $new = array();
    
    
                $chunks = $d;
    
    
                $chunks = str_replace(' and', '. and', $chunks);
    
    
                $chunks = str_replace(',', '.', $chunks);
    
    
                $chunks = str_replace('!', '.', $chunks);
    
    
                $chunks = explode('.',$chunks);
    
    
                $words = $this->get_word_filter_array();
    
    
    
    
    
                foreach($chunks as $sentence) {
    
    
                    $stop = 0;
    
    
                    foreach($words as $word) {
    
    
                        $pos = strpos(strtolower($sentence), strtolower($word));
    
    
    
    
    
                        if ($pos !== false) { $stop = 1; }
    
    
                    }
    
    
                    if(! $stop){
    
    
                        $new[] = $sentence;
    
    
                    }
    
    
                }
    
    
                $new = implode('.',$new);
    
    
                $d = $new;
    
    
                if(trim($d) == '' || strlen(trim($d)) < 3){
    
    
                    $d = $this->title;
    
    
                }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            }
    

    so that’s the code. Line 1385 is the line above “foreach($word as $word) {” .. yeah thats right.. the blank one.

    #145306
    Alen
    Participant

    Make sure you check that you’re not passing in empty string to strpos() function. var_dump($word); in the foreach($words as $word) code block.

    http://stackoverflow.com/questions/4105067/php-what-does-warning-strpos-function-strpos-empty-delimiter-in-mean

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.