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

Bug #18872 Class tree puts comma uncorrectly in interfaces list
Submitted: 2011-09-25 13:38 UTC
From: drunkenstranger Assigned: ashnazg
Status: Closed Package: PhpDocumentor (version SVN)
PHP Version: 5.2.12 OS: Windows XP
Roadmaps: 1.4.4    
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 : 38 - 13 = ?

 
 [2011-09-25 13:38 UTC] drunkenstranger (Drunken Stranger)
Description: ------------ Class tree puts comma uncorrectly in interfaces list. Test script: --------------- <?php /** Test file for MyPackage2 class tree * @package MyPackage */ /** @package MyPackage */ interface MyInterface {} /** @package MyPackage */ interface MyInterface2 {} /** @package MyPackage */ interface MyInterface3 {} /** @package MyPackage */ class MyClass implements MyInterface, MyInterface2, MyInterface3 {} /** @package MyPackage */ class MyClass2 extends MyClass {} ?> Expected result: ---------------- Root class MyClass MyClass (implements MyInterface, MyInterface2, MyInterface3) MyClass2 Actual result: -------------- Root class MyClass MyClass (implements MyInterface, MyInterface2MyInterface3) MyClass2

Comments

 [2011-09-25 13:58 UTC] drunkenstranger (Drunken Stranger)
 [2011-09-25 14:01 UTC] drunkenstranger (Drunken Stranger)
This patch works only for HTML:frames converter (you can fix another manually - just replace original getRootTree method). Also this patch fixes: http://pear.php.net/bugs/bug.php?id=18870 http://pear.php.net/bugs/bug.php?id=18871
 [2011-10-08 01:11 UTC] ashnazg (Chuck Burgess)
-Roadmap Versions: +Roadmap Versions: 1.4.4
 [2011-10-13 01:40 UTC] ashnazg (Chuck Burgess)
-Assigned To: +Assigned To: ashnazg
Tried to verify this behavior using v1.4.3 against PHP 5.3.8 and 5.2.17, but tests are being affected by interface names failing to appear in the place where the commas are expected. Presumably this is due to some combination of bug 18870 and bug 18871, and the bug reporter likely discovered this bug when patching his code for the other two bugs. I'll have to get the other two bugs patched and tested before verifying this bug behavior, I think. As an aside, the issue is irrelevant when using PHP 4.4.9.
 [2011-10-13 16:42 UTC] drunkenstranger (Drunken Stranger)
Nope, this tested with clear SVN trunk head revision (changed only "phpdoc" & "phpdoc.bat"). But only with HTML:frames:default converter. Review this with 318072 revision - the same result. /* https://svn.php.net/repository/pear/packages/PhpDocumentor/trunk/phpDocumentor/Converters/HTML/frames/HTMLframesConverter.inc:318062 lines:1361-1368 */ foreach ($implements as $i => $interface) { if ($i && $i != count($implements) - 1) $my_tree .= ', '; if ($link = $this->getLink('object ' . $interface)) { $my_tree .= $this->returnSee($link); } else { $my_tree .= $interface; } } // comma puts condition: if ($i && $i != count($implements) - 1) $my_tree .= ', '; So $i should be greater than 0 and not the last. And this is mistake because comma puts BEFORE interface. To fix this bug (not tested) just remove second condition. // comma puts fixed condition: if ($i > 0) $my_tree .= ', ';
 [2011-10-13 16:45 UTC] drunkenstranger (Drunken Stranger)
Or maybe we had $implements arrays with different keys?
 [2011-10-14 09:21 UTC] ashnazg (Chuck Burgess)
-Status: Assigned +Status: Closed
Followed the concept of the provided patch to pull interface handling outside of the child class handling logic. Tests good on PHP 5.3.8, 5.2.17, and 4.4.9 to solve the interface listing issues in the class list view. Committed to SVN.