PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Tools and Utilities » MIME_Type » Bug #2083

get() throws notice about $this->parameters being undefined.

Details

Submitted2004-08-07 20:18 UTC
Fromscragz at hotmail dot com
Assignedieure
StatusClosed
PackageMIME_Type
PHP Version4.3.4
OSDebian 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;
}