How do I resolve a strpos() "empty delimiter" error? How do I resolve a strpos() "empty delimiter" error? php php

How do I resolve a strpos() "empty delimiter" error?


This error occurs when the second parameter to strpos is empty. For instance, I can easily simulate this error at the command line:

$ php<?phpecho strpos("foo", "");?>^DWarning: strpos(): Empty delimiter in - on line 2

In your code, it means that $fgParams->get('base') is empty.

Add some checks to your code to ensure that the values you pass to strpos are valid, and the error will go away.


Change line 445

from

if($src = $img->getAttribute('src') AND strpos($src,$fgParams->get('base')) === false) { // prevents repeat processing

to

if($src = $img->getAttribute('src') AND $fgParams->get('base')!="" AND strpos($src,$fgParams->get('base')) === false) { // prevents repeat processing

Seems like that get('base') is returning nothing. Is this possible in your script? perhaps it's the indication of a previous error in another area of the program.


Please make sure that value of $fgParams->get('base') is not blank as json mentioned in condition.