ZF-8466: improvement method Zend_Application_Bootstrap_BootstrapAbstract::setOptions()


 * Set class state
 * @param  array $options
 * @return Zend_Application_Bootstrap_BootstrapAbstract
public function setOptions(array $options)
    $this->_options = $this->mergeOptions($this->_options, $options);

    $options = array_change_key_case($options, CASE_LOWER);
    $this->_optionKeys = array_merge($this->_optionKeys, array_keys($options));

    $methods = get_class_methods($this);
    foreach ($methods as $key => $method) {
        $methods[$key] = strtolower($method);

    if (array_key_exists('pluginpaths', $options)) {
        $pluginLoader = $this->getPluginLoader();

        foreach ($options['pluginpaths'] as $prefix => $path) {
            $pluginLoader->addPrefixPath($prefix, $path);

    foreach ($options as $key => $value) {
        $method = 'set' . strtolower($key);

        if (in_array($method, $methods)) {
        } elseif ('resources' == $key) {
            foreach ($value as $resource => $resourceOptions) {
                $this->registerPluginResource($resource, $resourceOptions);
    return $this;

coming when the configuration of the ini file with the following options:

application = "xxx"
container   = "xxx"
options     = "xx" 
pluginloader = "xxx"


Sugestion Patch 1 Assign these values mentioned above in a sort of black list of reserved words, if there is an attempt to use throws an exception.

Sugestion Patch 2 Returns only the methods of the last class ignoring the inherited methods.

I have thought about something like the first suggestion yesterday ! You already have proposed a patch. I vote for it !


Too think more friendly first patch, equal resolved in Zend_Form_Element::setOptions()

if (in_array($method, array('setTranslator', 'setPluginLoader', 'setView'))) {
    if (!is_object($value)) {

I will improve patch add tests unit.

Attached patch ZF-8466.patch with tests, to parse.

Thanks advance.

@Ramon I've also noticed that the same blacklist pattern should be needed in Zend_Layout::setOptions()