Re: ce->doc_comment and ReflectionClass::getDocComment

From: Date: Fri, 27 Feb 2009 23:29:35 +0000
Subject: Re: ce->doc_comment and ReflectionClass::getDocComment
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-6176@lists.php.net to get a copy of this message
Hi, On Fri, 2009-02-27 at 16:07 +0100, Piotr Pokora wrote: > Hi! > > Why internal class (registered in extension) can not provide own doc block? > > if (ce->type == ZEND_USER_CLASS && ce->doc_comment) { > RETURN_STRINGL(ce->doc_comment, ce->doc_comment_len, 1); > } > > Reflection works very nice for internal classes. Why this method can not? Interesting question, never looked into that myself. After digging around a bit I saw that, when initializing the class entry we aren't initializing the doc_comment field. So currently it might point to some random memory. While changing that should be quite simple. http://lxr.php.net/source/ZendEngine2/zend_API.h#163 Not sure whether there are other things to consider and whether there's a reason. Andrei, if I read the log correctly you added that just 6 yeas ago, do you, by chance, remember any reason for that? -- I think this might be quite nice for providing at least short self-documentation using "php --rc classname" johannes

« previous php.pecl.dev (#6176) next »