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

Bug #11654 @static in DocBlock Template can cause PHP Notice
Submitted: 2007-07-20 20:13 UTC
From: ashnazg Assigned: ashnazg
Status: Closed Package: PhpDocumentor (version 1.4.0RC2)
PHP Version: 5.1.6 OS:
Roadmaps: 1.4.3    
Subscription  


 [2007-07-20 20:13 UTC] ashnazg (Chuck Burgess)
Description: ------------ If a docblock template contains @static, and then gets applied to an element with its own docblock, the @static will cause a PHP "undefined offset" notice. This does NOT happen when the docblock template gets applied to elements without their own docblocks. Also, this does NOT cause the "static" keyword to be missing from the element's generated doc... it's there just fine. The only issue is the occurrence of the PHP Notice. Interestingly, running the same test file against the same v1.4.0, but on PHP 4.4.2 on Linux, results in the same notice but shows line 593 rather than 592. But, since only line 592 has a reference to "[0]" whereas line 593 does not, I assume the notice is still effectively the same condition. Test script: --------------- <?php /** * bug test file * @package BugReports */ /** * test class * @package BugReports */ class testClass { /**#@+ * template text * @static */ var $one; var $two; /** * @var string */ var $three; /**#@-*/ } ?> Expected result: ---------------- Reading file /myBugReport.php -- Parsing file Actual result: -------------- Reading file /myBugReport.php -- Parsing file Notice: Undefined offset: 0 in PhpDocumentor/phpDocumentor/ParserDocBlock.inc on line 592

Comments

 [2008-03-31 13:09 UTC] ashnazg (Chuck Burgess)
Verified this bug still exists in v1.4.2 on PHP 5.2.5.
 [2009-07-02 01:50 UTC] mvriel (Mike Van Riel)
The following patch has been added/updated: Patch Name: add-validate-on-index Revision: 1246481441 URL: http://pear.php.net/bugs/patch-display.php?bug=11654&patch=add-validate-on-index&revision=1246481441&display=1
 [2009-07-02 01:53 UTC] mvriel (Mike Van Riel)
The DocBlock parser wants to see a value with the @static tag. By providing just the tag, thus without value, a notice appears because this situation is not validated. The attached patch adds such a validation to the addTag method.
 [2009-08-30 11:10 UTC] ashnazg (Chuck Burgess)
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: ashnazg
 [2009-08-30 11:15 UTC] ashnazg (Chuck Burgess)
Used a variation on mvriel's patch... tests good on all my testbeds (PHP 5.3.0, 5.2.10, 5.1.6, 5.0.5, 4.4.9) with current SVN of phpDocumentor plus the bugfix. The notice is cleared, while the output docs remain correct.
 [2009-08-30 11:32 UTC] ashnazg (Chuck Burgess)
-Status: Assigned +Status: Closed
Committed to SVN. Mike, thanks for the patch.