Home » Tools and Utilities » MIME_Type » Bug #2083
get() throws notice about $this->parameters being undefined.
Details
| Submitted | 2004-08-07 20:18 UTC |
|---|---|
| From | scragz at hotmail dot com |
| Assigned | ieure |
| Status | Closed |
| Package | MIME_Type |
| PHP Version | 4.3.4 |
| OS | Debian Sarge |
| Roadmaps | (Not assigned) |
Comments
[2004-08-07 20:18 UTC] scragz at hotmail dot com
Description:
------------
$parameters should either be defined in the constructor beforehand or tested with isset() before being used. Also in the get method, count will return true if parameters is a string and the foreach following would throw an error. See below for a fixed version.
Reproduce code:
---------------
function get()
{
$type = strtolower($this->media.'/'.$this->subType);
if (isset($this->parameters) && is_array($this->parameters) && count($this->parameters)) {
foreach ($this->parameters as $key => $null) {
$type .= '; '.$this->parameters[$key]->get();
}
}
return $type;
}