zenovich / runkit

Runkit (official PECL PHP Runkit extension)
http://pecl.php.net/runkit
Other
611 stars 136 forks source link

runkit_method_copy does not copy doc_comment from original method #61

Closed white-bear closed 9 years ago

white-bear commented 10 years ago

issue found in function php_runkit_method_add_or_update to fix this issue I'm add code, listed below, after 435 line (which is: func.common.function_name = estrndup(methodname, methodname_len);):

ifdef ZEND_ENGINE_2

if (add_or_update == HASH_UPDATE) { func.op_array.doc_comment = estrndup(orig_fe->op_array.doc_comment, orig_fe->op_array.doc_comment_len); func.op_array.doc_comment_len = orig_fe->op_array.doc_comment_len; }

endif

Also there is no way to create function with doc_comment

zenovich commented 9 years ago

Can't reproduce, see test.

white-bear commented 9 years ago

When you call runkit_method_redefine with new doc_comment, it's ok. But when you skip this arg, there is no doc_comment at all. ReflectionMethod->getDocComment() will return bool(false). Probably, it would be better to copy old doc_comment

zenovich commented 9 years ago

Fixed