Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a1

Bug #10864 PhpDocumentor dies when parsing illegal page-level docblock
Submitted: 2007-04-27 20:28 UTC
From: isnull Assigned: ashnazg
Status: Closed Package: PhpDocumentor (version 1.4.0a1)
PHP Version: 5.2.1 OS: gentoo ~arch
Roadmaps: 1.4.0a2    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 - 18 = ?

 
 [2007-04-27 20:28 UTC] isnull
Description: ------------ PhpDocumentor dies when parsing @access in page-level docblocke Test script: --------------- http://pastebin.ca/461591 Expected result: ---------------- A nice error or warning Actual result: -------------- Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1439 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6702 10885020 7. phpDocumentor_IntermediateParser->addPage() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:676 0.6702 10885020 8. phpDocumentor_IntermediateParser->addPrivatePage() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1370 Dump $_SERVER Dump $_GET Dump $_POST Dump $_COOKIE Dump $_FILES Dump $_ENV Dump $_SESSION Dump $_REQUEST Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1449 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6702 10885020 7. phpDocumentor_IntermediateParser->addPage() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:676 0.6702 10885020 8. phpDocumentor_IntermediateParser->addPrivatePage() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1370 Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1450 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6702 10885020 7. phpDocumentor_IntermediateParser->addPage() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:676 0.6702 10885020 8. phpDocumentor_IntermediateParser->addPrivatePage() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1370 Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1497 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6716 10885020 7. phpDocumentor_IntermediateParser->addUses() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:677 Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1501 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6716 10885020 7. phpDocumentor_IntermediateParser->addUses() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:677 Notice: Trying to get property of non-object in /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc on line 1501 Call Stack: 0.0002 56620 1. {main}() /usr/bin/phpdoc:0 0.0005 66464 2. include('/usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc') /usr/bin/phpdoc:37 0.1094 8533656 3. phpDocumentor_setup->createDocs() /usr/share/php/PhpDocumentor/phpDocumentor/phpdoc.inc:61 0.6695 11001256 4. phpDocumentor_IntermediateParser->Output() /usr/share/php/PhpDocumentor/phpDocumentor/Setup.inc.php:743 0.6701 10885020 5. phpDocumentor_IntermediateParser->fixProcPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1805 0.6701 10885020 6. ProceduralPages->setupPages() /usr/share/php/PhpDocumentor/phpDocumentor/IntermediateParser.inc:1673 0.6716 10885020 7. phpDocumentor_IntermediateParser->addUses() /usr/share/php/PhpDocumentor/phpDocumentor/ProceduralPages.inc:677

Comments

 [2007-04-27 20:29 UTC] isnull
Forgot to precise that this bug also occurs in stable version
 [2007-04-27 20:41 UTC] ashnazg (Chuck Burgess)
Helped james___ in #pear IRC with this issue, determined it to simply be an @access tag in the page-level docblock. Need to fix phpdoc to just show a warning for that, not crash.
 [2007-05-03 17:18 UTC] ashnazg (Chuck Burgess)
Actually, now that I've made my own test file, this only happens when using "@access private" on the page-level docblock... using "@access public" or "@access protected" doesn't cause any problem at all. I suppose the fix is still to spot an access tag in the page-level docblock and throw a warning, regardless of what the access level value is...
 [2007-05-03 17:21 UTC] ashnazg (Chuck Burgess)
The plot thickens... Using "--parseprivate on" along with a page-level "@access private" doesn't cause a failure. So, from all angles it actually appears that the access tag SHOULD be allowed in the page-level docblock, but that some kind of error handling needs to deal with a "private" file when --pp is off.
 [2007-05-03 17:28 UTC] jeichorn (Joshua Eichorn)
My assumption would be that a page marked private shouldn't show up in the docs unless parseprivate is turned on
 [2007-05-03 17:31 UTC] ashnazg (Chuck Burgess)
Given that the "property of non-object" notices occur in the addPrivatePage() method, I'm now quite sure that private pages are indeed allowed.
 [2007-05-03 17:36 UTC] ashnazg (Chuck Burgess)
I now see that it only "crashes" when I have absolutely no public files in the whole parse set. So, if I only have one file, and it's set access private in the page-level docblock, I effectively have "nothing to parse"... which is exactly what PhpDocumentor is telling me. That simple message is just being cluttered up by all the PHP Notices about non-objects.
 [2007-05-03 17:37 UTC] jeichorn (Joshua Eichorn)
It would seem to me the fix needs to just be removing all those warnings
 [2007-05-03 17:42 UTC] ashnazg (Chuck Burgess)
Thinking the same thing, Josh... that's what I'm focusing on.
 [2007-05-03 22:00 UTC] ashnazg (Chuck Burgess)
This patch has four distinct parts... The first part handles this bug specifically. I can't see any repercussions from instantiating an empty ParserData object in order to allow that setParent method to be available. Both sections have been commented out like this since the code was imported into CVS, so it's effectively "never been in play". It works in my unit test (which I created specifically for this bug) and in my testing against my test file for this bug. The second part clears up some PHP Notices that were appearing while testing this bug via my test file. The third and fourth parts are "commented-out" cleanup. In each place, there was an IF that was commented out, but its braces were not. I've removed the commented-out IFs and their resulting redundant braces. Josh, ready for your review.
 [2007-05-03 22:12 UTC] jeichorn (Joshua Eichorn)
Everything looks good, commit away On a style note, don't use /** for non docblocks just use /*
 [2007-05-03 22:30 UTC] ashnazg (Chuck Burgess)
Committed to CVS. Thanks for the style tip, Josh...