Home » Tools and Utilities » PhpDocumentor » Bug #9915
PHP Notice in PDF Converter
Details
| Submitted | 2007-01-22 17:02 UTC |
|---|---|
| From | berdir at php dot net |
| Assigned | ashnazg |
| Status | Closed |
| Package | PhpDocumentor |
| PHP Version | 5.1.6 |
| OS | Linux |
| Roadmaps | 1.3.2 |
Comments
[2007-01-22 17:02 UTC] berdir at php dot net
Description:
------------
When creating a PDF with phpDoc I got some of these error messages:
Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/Converters/PDF/default/PDFdefaultConverter.inc on line 400
Call Stack:
0.0003 42520 1. {main}() /usr/bin/phpdoc:0
0.0009 51456 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37
0.7520 9436384 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61
51.4230 51140528 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:681
53.7578 52701776 5. phpDocumentor_IntermediateParser->Convert() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1802
53.7578 52701776 6. Converter->walk() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1589
54.8160 53710528 7. Converter->walk_everything() /usr/share/php/PhpDocumentor/phpDocumentor/Converter.inc:1842
201.3689 73667280 8. Converter->Convert() /usr/share/php/PhpDocumentor/phpDocumentor/Converter.inc:2380
201.3689 73667280 9. PDFdefaultConverter->convertMethod() /usr/share/php/PhpDocumentor/phpDocumentor/Converter.inc:3970
[2007-02-15 18:50 UTC] ashnazg at php dot net
Sascha, are you able to isolate this error down to one particular file of yours that you are documenting? If so, can you use it to construct a small example file that I can use to duplicate the error?
[2007-02-16 22:01 UTC] ashnazg at php dot net
Sascha, never mind... I can already duplicate this error with files I have in hand.
[2007-02-16 22:05 UTC] ashnazg at php dot net
I see these notices when running current CVS HEAD (v1.3.1+) against PHP v5.2.0 and v5.1.6, but NOT when running against v4.4.4. Hmmm.
[2007-02-16 22:58 UTC] ashnazg at php dot net
In my initial testing, changing line 400 in PDFDefaultConverter.inc
from:
if (isset($element->docblock->return))
to:
if ($element->docblock->return)
prevents those notices from occurring. I still need to doublecheck the generated docs to see what difference (if any) that makes in the output.
Sascha, can you apply this one-line change to your PhpDocumentor install, see if it clears up the PHP Notices for you, and see if the generated PDF doc looks any different than the one the normal v1.3.1 creates?
[2007-02-19 21:49 UTC] ashnazg at php dot net
That should have read "line 398" rather than "line 400"...
[2007-02-19 21:57 UTC] ashnazg at php dot net
In my comparisons of the PDF output with/without that one-line change, the only difference I'm seeing is that with the change, all the functions with an implied "void" return type (i.e. no explicit return command AND no @return tag) are now successfully showing the return type, whereas without the one-line change no return type is shown in the PDF for those functions.
It looks like this fix not only solves the PHP Notices, but also is necessary for the implied "void" return types to work properly with the PDF Converter. I assume that means the notices were caused by the failure of the converter to derive what the return type was supposed to be.
[2007-02-20 14:27 UTC] ashnazg at php dot net
Fix ok'd by Greg, committed to CVS.