Zend Framework

Zend_Application_Resource_ResourceAbstract::setOptions kills array-element with key == (int)0

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.6
  • Fix Version/s: 1.10.0
  • Labels:
    None

Description

I was writing a Resource where I was always missing the first option inside My_Application_Resource_Foo::init();

Some Code:
--------------------------------------------------------
$options = array(
array('someData'),
array('someMoreData'),
);

$resource = new My_Application_Resource_Foo($options);
$resource->init();
--------------------------------------------------------
The problem is when $options is an array with numeric indizes the 0 always gets dropped because of this line:

if ('bootstrap' == $key) { unset($options[$key]); }

in Zend_Application_Resource_ResourceAbstract::setOptions()

because ('bootstrap' == 0) == true

using === instead of == fixed the problem for me:


if ('bootstrap' === $key) { unset($options[$key]); }
}

Activity

Hide
Matthew Weier O'Phinney added a comment -

Fixed in trunk.

Show
Matthew Weier O'Phinney added a comment - Fixed in trunk.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: