HTML/Table.php generating notice...
| From: | Tommy Ipsen | Date: | Thu, 10 Apr 2003 19:10:59 +0000 |
| Subject: | HTML/Table.php generating notice... | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4785@lists.php.net to get a copy of this message | ||
Hi
I don't know whether this is the correct place to post this but here it goes (otherwise please tell me the place!):
When using the HTML_Table class I get the following notice:
Notice: Uninitialized string offset: 0 in ***\HTML\Table.php on line 685
The problem is in the following function in the first if-condition where the $attributes variable isn't necesarily an array.
function _isAttributesArray($attributes)
{
if (isset($attributes[0])) {
if (is_array($attributes[0]) || (is_string($attributes[0]) && count($attributes) > 1)) {
return true;
}
}
return false;
} // end func _isAttributesArray
I've thought about the following change which seems to work without generating any notices - is there anything wrong with this?
function _isAttributesArray($attributes)
{
if (is_array($attributes) && isset($attributes[0])) {
if (is_array($attributes[0]) || (is_string($attributes[0]) && count($attributes) > 1)) {
return true;
}
}
return false;
} // end func _isAttributesArray