Uninitialized string offset: 0
| From: | Albert Padley | Date: | Sat, 06 Jan 2007 18:58:26 +0000 |
| Subject: | Uninitialized string offset: 0 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-246687@lists.php.net to get a copy of this message | ||
I have the following class that generates a Notice: Uninitialized string offset: 0 each time it is called. The lines generating the notice are marked. How do I fix this?
class InputFilter {
var $tagsArray;
var $attrArray;
var $tagsMethod;
var $attrMethod;
var $xssAuto;
var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml');
var $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc');
function inputFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) {
for ($i = 0; $i < count($tagsArray); $i++) $tagsArray[$i] = strtolower($tagsArray[$i]); //<< Notice Generated Here
for ($i = 0; $i < count($attrArray); $i++) $attrArray[$i] = strtolower($attrArray[$i]); //<< Notice Generated Here also
$this->tagsArray = (array) $tagsArray;
$this->attrArray = (array) $attrArray;
$this->tagsMethod = $tagsMethod;
$this->attrMethod = $attrMethod;
$this->xssAuto = $xssAuto;
}
}
TIA.
Al Padley