Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: TheSeer\phpDox\ClassBuilderException #80

Closed
pawel88nowak opened this issue Nov 5, 2012 · 4 comments
Closed

Exception: TheSeer\phpDox\ClassBuilderException #80

pawel88nowak opened this issue Nov 5, 2012 · 4 comments

Comments

@pawel88nowak
Copy link

I've got this exception during jenkins building php job on windows 7.
[exec] phpdox 0.4.0 - Copyright (C) 2010 - 2012 by Arne Blankerts
[exec]
[exec] [05.11.2012 - 13:14:26] Using config file 'E:\Web Development\Jenkins\workspace\coach\phpdox.xml'
[exec] [05.11.2012 - 13:14:26] Registered output engine 'html'
[exec] [05.11.2012 - 13:14:26] Registered output engine 'graph'
[exec] [05.11.2012 - 13:14:26] Registered output engine 'todo'
[exec] [05.11.2012 - 13:14:26] Registered output engine 'xslrunner'
[exec] [05.11.2012 - 13:14:26] Starting to process project 'name-of-project'
[exec] [05.11.2012 - 13:14:26] Starting collector
[exec]
[exec]
[exec]
[exec] Oups... phpDox encountered a problem and has terminated!
[exec] It most likely means you've found a bug, so please file a report for this and paste the stacktrace (if given) along!
[exec]
[exec] Exception: TheSeer\phpDox\ClassBuilderException
[exec] Location: E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\collector\ClassBuilder.php (Line 127)
[exec]
[exec] Processing DocBlock failed
[exec]
[exec] #0 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\collector\ClassBuilder.php(92): TheSeer\phpDox\ClassBuilder->processMethods()
[exec] #1 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\collector\Analyser.php(114): TheSeer\phpDox\ClassBuilder->process()
[exec] #2 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\collector\Analyser.php(85): TheSeer\phpDox\Analyser->handleClass()
[exec] #3 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\collector\Collector.php(89): TheSeer\phpDox\Analyser->processFile()
[exec] #4 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\Application.php(123): TheSeer\phpDox\Collector->run()
[exec] #5 E:\Web Development\wamp\bin\php\php5.4.3\pear\TheSeer\phpDox\CLI.php(124): TheSeer\phpDox\Application->runCollector()
[exec] #6 E:\Web Development\wamp\bin\php\php5.4.3\phpdox(62): TheSeer\phpDox\CLI->run()
[exec]
[exec]
[exec]
[exec] .f
[exec] Result: 1

My build phpdox target:
"

"

My phpdox.xml file:
"




"

Is it some bug or my missconfiguration of something?

@leonboot
Copy link

leonboot commented Nov 6, 2012

I had the exact same error. After inserting some var_dumps here and there, I found out that phpdox broke on a method docblock in one of the files. Here's the docblock it freaked out on:

/**
 * Function to unset poposponed calls
 * @param type $id
 * @param type $actionName
 * @param type $arguments
 *
 * @ Todo this is the way it should work but it doesnt
 */

Note the last line, it has a space between the @ and the Todo; a typo from one of our developers. But phpdox doesn't like it at all and throws an exception. Fixing the @todo parameter resulted in a succesful build of the documentation.

I suppose it would be better if phpdox just ignored such typos?

@theseer
Copy link
Owner

theseer commented Nov 6, 2012

Thank you for reporting this issue. I agree that phpDox should be more robust with these kind of typos.

Can you please verify if that problem persists with the latest phpdox code from GIT as that had some major refactoring being done?

(Instructions on how to install dependencies are in the developer section of the https://github.com/theseer/phpdox/blob/master/README.markdown)

@leonboot
Copy link

leonboot commented Nov 6, 2012

Ok, built the 0.4.99 version from Git (did a git clone, pear package and pear install, but only the /usr/bin/phpdox executable was installed, I had to manually copy the src dir to $PEAR/TheSeer/phpDox) and installed the dependencies.

I ran phpdox and it almost immediately died, stating Static was not a valid backend. I found out the CollectionConfig->getBackend() returns 'Static' of no backend was specified in the phpdox.xml file, which is not a valid backend. After updating my xml config I reran phpdox and I get numerous parse errors from the PHPParser library:

  • Doesn't allow a class called Callable (both definition and instancing it produces "Unexpected token T_CALLABLE")
  • Doesn't allow empty php files (iconv(): Wrong charset, conversion from binary' toUTF-8//TRANSLIT' is not allowed)
  • Seems to end up in an infinite nesting loop (in this case in the ZF class Zend_Validate_Hostname_Biz class, PHPParser dies with "Maximum function nesting level of '100' reached, aborting!")

So, this seems to be even more of a no go than the current PEAR build, 0.4.0. I gave up fixing the errors PHPParser produced after the nesting loop.

On a side note, it's a tad challenging to figure out which file causes the problem. If you're lucky, the PHPParser_Error class gives you a line number, but there's no way to tell which file it refers to. I hacked the script TheSeer/phpDox/collector/Collector.php and added an echo "$file\n" just before $this->processFile($file).

@theseer
Copy link
Owner

theseer commented Feb 8, 2013

The class ClassBuilder has been removed from phpDox during refactoring, the general stability on parse errors as well as other processing errors should be fixed.

The nesting level limitation is not a PHP feature but something added by xdebug. While okay for general website development xdebug should be disabled on CLI tools as it slows down processing dramatically and adds various other limitations.

The collector also outputs more detailed information, what files it had issues with in case it ran into any.
Closing this ticket.

@theseer theseer closed this as completed Feb 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants