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

Bug #14640 class witch extending DOMDocument
Submitted: 2008-09-12 06:34 UTC
From: xsiska Assigned: ashnazg
Status: Closed Package: PhpDocumentor (version 1.4.2)
PHP Version: 5.2.6 OS: Win32
Roadmaps: 1.4.4    
Subscription  


 [2008-09-12 06:34 UTC] xsiska (Jakub Siska)
Description: ------------ PhpDocumentator is failing to make documentation in file witch has code with class that is extending DOMDocument. eg. class fcomp extends DOMDocument{ /** * constructor * */ function __construct() { pasrent::__construct(); } } Test script: --------------- <? class fcomp extends DOMDocument{ /** * Constructor * */ function __construct() { pasrent::__construct(); } } ?> Expected result: ---------------- success Actual result: -------------- Parsing Files ... PHP Version 5.2.6 phpDocumentor version 1.4.1 Parsing configuration file phpDocumentor.ini... (found in C:/apache2triad/htdocs/phpdoc/)... done Maximum memory usage set at 256M after considering php.ini... using tokenizer Parser Grabbing README/INSTALL/CHANGELOG done Tutorial/Extended Documentation Parsing Stage done General Parsing Stage Reading file C:/apache2triad/htdocs/lukas/ReeGOSystem/a.php -- Parsing file WARNING in a.php on line 1: no @package tag was used in a DocBlock for class fcomp WARNING in a.php on line 10: File "C:\apache2triad\htdocs\lukas\ReeGOSystem\a.php" has no page-level DocBlock, use @package in the first DocBlock to create one done Converting From Abstract Parsed Data Processing Class Inheritance Processing Root Trees Processing leftover classes (classes that extend root classes not found in the same package) Processing fcomp in file C:\apache2triad\htdocs\lukas\ReeGOSystem\a.php done processing leftover classes Processing Procedural Page Element Name Conflicts Sorting page elements...done Formatting @uses list...done creating C:\apache2triad\htdocs\lukas\ReeGOSystem/\media copying C:\apache2triad\htdocs\lukas\ReeGOSystem/\media/background.png copying C:\apache2triad\htdocs\lukas\ReeGOSystem/\media/empty.png copying C:\apache2triad\htdocs\lukas\ReeGOSystem/\media/style.css Building indexes...done Sorting Indexes...done Sorting @todo list...done Converting tutorials/extended docs Formatting Package Indexes... Writing C:\apache2triad\htdocs\lukas\ReeGOSystem/elementindex_default.html done Formatting Index... Writing C:\apache2triad\htdocs\lukas\ReeGOSystem/elementindex.html Writing C:\apache2triad\htdocs\lukas\ReeGOSystem/li_default.html Writing C:\apache2triad\htdocs\lukas\ReeGOSystem/index.html done Formatting Left Quick Index... Writing C:\apache2triad\htdocs\lukas\ReeGOSystem/classtrees_default.html done Converting C:\apache2triad\htdocs\lukas\ReeGOSystem\a.php Procedural Page Elements... Classes... Fatal error: Uncaught exception 'ReflectionException' with message 'Class DOMUserData does not exist' in C:\apache2triad\htdocs\phpdoc\phpDocumentor\ParserElements.inc:1106 Stack trace: #0 C:\apache2triad\htdocs\phpdoc\phpDocumentor\ParserElements.inc(1106): ReflectionParameter->getClass() #1 C:\apache2triad\htdocs\phpdoc\phpDocumentor\Converter.inc(4911): parserClass->getInheritedMethods(Object(HTMLSmartyConverter)) #2 C:\apache2triad\htdocs\phpdoc\phpDocumentor\Converter.inc(4075): Converter->getFormattedInheritedMethods(Object(parserClass)) #3 C:\apache2triad\htdocs\phpdoc\phpDocumentor\Converters\HTML\Smarty\HTMLSmartyConverter.inc(1080): Converter->convertClass(Object(parserClass)) #4 C:\apache2triad\htdocs\phpdoc\phpDocumentor\Converter.inc(3983): HTMLSmartyConverter->convertClass(Object(parserClass)) #5 C:\apache2triad\htdocs\phpdoc\phpDocumentor\Converter.inc(1934): Converter->Convert(Object(parserClass)) #6 C:\apache2triad\htdocs\phpdoc\phpDocumentor\IntermediateParser.inc(1652): Converter->walk(Array, Array) #7 in C:\apache2triad\htdocs\phpdoc\phpDocumentor\ParserElements.inc on line 1106

Comments

 [2008-12-05 08:57 UTC] drx777 (David Rekowski)
I can confirm that for Linux, PHP 5.2.6-2ubuntu4 with Suhosin-Patch 0.9.6.2 (cli) Simpler test case: ------------------ <?php class test extends DOMElement { } ?> Error output: ------------- Converting /var/www/test.php Procedural Page Elements... Classes... ReflectionException: Class DOMUserData does not exist in /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/ParserElements.inc on line 1106 Call Stack: 0,0105 62112 1. {main}() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpdoc:0 0,0294 75616 2. include('/var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/phpdoc.inc') /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpdoc:59 0,3427 9555100 3. phpDocumentor_setup->createDocs() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/phpdoc.inc:65 0,3479 9583624 4. phpDocumentor_IntermediateParser->Output() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Setup.inc.php:754 0,4030 9695880 5. phpDocumentor_IntermediateParser->Convert() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/IntermediateParser.inc:1865 0,4030 9695880 6. Converter->walk() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/IntermediateParser.inc:1652 0,5197 9760380 7. Converter->Convert() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Converter.inc:1934 0,5197 9760380 8. HTMLframesConverter->convertClass() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Converter.inc:3983 0,5197 9760380 9. Converter->convertClass() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Converters/HTML/frames/HTMLframesConverter.inc:1032 0,5205 9770472 10. Converter->getFormattedInheritedMethods() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Converter.inc:4075 0,5206 9770544 11. parserClass->getInheritedMethods() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/Converter.inc:4911 0,5303 9952216 12. ReflectionParameter->getClass() /var/www/PhpDocumentor-1.4.2/PhpDocumentor-1.4.2/phpDocumentor/ParserElements.inc:1106
 [2009-07-21 21:36 UTC] ashnazg (Chuck Burgess)
-Roadmap Versions: +Roadmap Versions: 1.4.3
 [2009-08-08 13:20 UTC] ashnazg (Chuck Burgess)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: ashnazg
I can duplicate this issue with both of the provided test classes, when using Ubuntu 9.04's provided PHP 5.2.6. However, it works perfectly with all my compiled PHP installations on the same box (5.3.0, 5.2.10, 5.1.6, 5.0.5, 4.4.9). This hints to me that it's some kind of issue with what is compiled into PHP or what extensions are available via php.ini.
 [2009-08-12 20:58 UTC] ashnazg (Chuck Burgess)
Note to self: check ext/dom...
 [2009-09-17 20:45 UTC] maarten (Maarten van Schaik)
I've done some searching and have come to the conclusion that the problem is that the method DOMNode::getUserData() is not implemented in the DOM-extension, but is prototyped. See ext/dom/node.c, line 1735 at revision 1.72 in the php source. The prototype mentions DomUserData as the class for the second argument 'data', but that class doesn't exist in PHP. The ReflectionClass will look for it and throw an error. Workaround is to define a dummy class DomUserData to prevent this error. On my system I've added the following line somewhere in the top of phpDocumentor/phpDocumentor/ParserElements.inc: class DomUserData { } and this successfully prevents the error.
 [2009-09-24 04:02 UTC] ashnazg (Chuck Burgess)
Thanks Maarten, that was exactly what I needed... I've opened PHP bug 49647 regarding DOMUserData's non-existence in the DOM extension's code. I will look at adding a workaround in phpDocumentor that will recognize this condition and declare a dummy DOMUserData class when it's needed.
 [2009-09-24 19:45 UTC] ashnazg (Chuck Burgess)
The PHP bug has been fixed, though only on the PHP6 trunk and 5_3 branch. I've asked that they also fix it on 5_2. Still, the final fix here will be the workaround to recognize and handle the issue. I still need to add that in the phpDocumentor code.
 [2009-10-11 01:39 UTC] ashnazg (Chuck Burgess)
The PHP bugfix did get applied to the 5_2 branch.
 [2009-10-11 02:38 UTC] ashnazg (Chuck Burgess)
-Status: Assigned +Status: Closed
Workaround fix added to Setup.inc.php... committed to SVN.
 [2009-10-11 02:51 UTC] bjori (Hannes Magnusson)
http://svn.php.net/viewvc?view=revision&revision=289507 looks very very wrong. I don't know how PhpDocumentor works internally, but that DOMUserData class has _never_ existed in PHP. It is a C comment, not an actual typehint or anything. If PhpDocumentor is scanning the proto lines then PhpDocmumentor should be updated to use real reflection.
 [2009-10-12 14:58 UTC] maarten (Maarten van Schaik)
It looks good to me. PhpDocumentor uses reflection. Maybe the reflection api scans the C comments? I don't know how reflection is implemented...