Jump to content

strpos() [function.strpos]: Empty delimiter


Recommended Posts

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.

class.prod.txt

Edited by Attila2452
Link to post
Share on other sites

Your FTP client is duplicating all of the line breaks when you download the file, you should transfer files in binary mode instead of ASCII mode. I assume it's referring to this line, because it's actually using strpos:

 

$pos = strpos(strtolower($sentence), strtolower($word));

 

If it says the delimiter is empty, it is referring to the word. So, the word is empty. This is where it gets the words from:

 

$words = $this->get_word_filter_array();

 

I'm not sure what get_word_filter_array returns, but apparently it is returning a blank value for one of the words. Maybe there's a section in your control panel for the site where you list filter words or something like that, and one of them is blank (maybe a blank line or something).

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...