/**
* Remove a filter, either by resource (handed out from the append or prepend function)
* or via getting the filter list)
*
* @param resource $resource The resource.
* @param boolean $byindex The index of the filter.
*
* @return boolean Result of operation
*
* @since 1.7.0
*/
public function removeFilter(&$resource, $byindex = false)
{
// Capture PHP errors
$php_errormsg = '';
$track_errors = ini_get('track_errors');
ini_set('track_errors', true);
if ($byindex) {
$res = stream_filter_remove($this->filters[$resource]);
} else {
$res = stream_filter_remove($resource);
}
if ($res && $php_errormsg) {
$this->setError($php_errormsg);
}
// Restore error tracking to what it was before.
ini_set('track_errors', $track_errors);
return $res;
}