Re: Re: ce->doc_comment and ReflectionClass::getDocComment
| From: | Alexey Zakhlestin | Date: | Fri, 05 Jun 2009 16:20:52 +0000 |
| Subject: | Re: Re: ce->doc_comment and ReflectionClass::getDocComment | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6454@lists.php.net to get a copy of this message | ||
2009/2/28 Johannes Schlüter <johannes@php.net>
> 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"
I will do it in trunk. Can't see the reason not to do.
Should I backport it to 5.3? Or it's too late already?
--
Alexey Zakhlestin
http://www.milkfarmsoft.com/
Sent from St Petersburg, Russian Federation