Zend Framework

hasMethod() and hasProperty() of Zend_CodeGenerator_Php_Class is not working

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.9.3
  • Component/s: Zend_CodeGenerator
  • Labels:
    None

Description

Methods and Properties are added via inherited append() of ArrayObject. All accesses to $this->_methods[$methodName] and $this->_properties[$propertyName] are not working because append() does not set any associative key.

My suggestion would be to not use append() or overriding it.

If indexed access is possible then getMethod() and getProperty() can be improved by dropping the loops and accessing the ArrayObject directly.

Activity

Hide
Khary Sharpe added a comment -

Would making the following changes address this?

Zend_CodeGenerator_Php_Class::setMethod() approx line 377 (r16971)

From:

$this->_methods->append($method);

To:

$this->_methods[$methodName] = $method;

Similarly

Zend_CodeGenerator_Php_Class::setProperty() approx line 299 (r16971)

From:

$this->_properties->append($property);

To:

$this->_properties[$propertyName] = $property;
Show
Khary Sharpe added a comment - Would making the following changes address this? Zend_CodeGenerator_Php_Class::setMethod() approx line 377 (r16971) From:
$this->_methods->append($method);
To:
$this->_methods[$methodName] = $method;
Similarly Zend_CodeGenerator_Php_Class::setProperty() approx line 299 (r16971) From:
$this->_properties->append($property);
To:
$this->_properties[$propertyName] = $property;
Hide
Rüdiger Krieg added a comment -

Yes, this is one way fixing the bug. In addition I would improve the code of the methods hasMethod() and hasProperty() as mentioned in the description.

Show
Rüdiger Krieg added a comment - Yes, this is one way fixing the bug. In addition I would improve the code of the methods hasMethod() and hasProperty() as mentioned in the description.
Hide
Rüdiger Krieg added a comment -

The priority of this issue was changed to "N/A - Not Applicable". I don't understand this priority
Does this mean the issue will not be solved?

Show
Rüdiger Krieg added a comment - The priority of this issue was changed to "N/A - Not Applicable". I don't understand this priority Does this mean the issue will not be solved?
Hide
Benjamin Eberlei added a comment -

Confirmed, i'll take it on

Show
Benjamin Eberlei added a comment - Confirmed, i'll take it on
Hide
Benjamin Eberlei added a comment -

Fixed in trunk and merged back into 1.9 release branch.

Show
Benjamin Eberlei added a comment - Fixed in trunk and merged back into 1.9 release branch.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: