ZF-7361: hasMethod() and hasProperty() of Zend_CodeGenerator_Php_Class is not working

Issue Type: Bug Created: 2009-07-23T04:54:28.000+0000 Last Updated: 2009-09-06T03:17:35.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: Rüdiger Krieg (dbc_rkrieg) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_CodeGenerator

Related issues: Attachments:


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.


Posted by Khary Sharpe (ksharpe) on 2009-07-23T16:27:59.000+0000

Would making the following changes address this?

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


<pre class="highlight"> 


<pre class="highlight"> 
$this->_methods[$methodName] = $method;


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


<pre class="highlight"> 


<pre class="highlight"> 
$this->_properties[$propertyName] = $property;

Posted by Rüdiger Krieg (dbc_rkrieg) on 2009-07-24T01:55:56.000+0000

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.

Posted by Rüdiger Krieg (dbc_rkrieg) on 2009-08-20T03:53:51.000+0000

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?

Posted by Benjamin Eberlei (beberlei) on 2009-09-06T02:55:14.000+0000

Confirmed, i'll take it on :-)

Posted by Benjamin Eberlei (beberlei) on 2009-09-06T03:17:29.000+0000

Fixed in trunk and merged back into 1.9 release branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.