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

Many exceptions running phpdox #99

Closed
NathanielMichael opened this issue May 30, 2013 · 18 comments
Closed

Many exceptions running phpdox #99

NathanielMichael opened this issue May 30, 2013 · 18 comments

Comments

@NathanielMichael
Copy link

Running the latest version with a fairly simple config on a small codebase is failing rather hard... can't quite figure out what's up.

EvilGenius:markii nate$ sudo pear install pear.netpirates.net/phpDox-0.5.0
theseer/phpDox is already installed and is the same as the released version 0.5.0

phpdox.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<phpdox xmlns="http://phpdox.de/config">
    <project name="markii" source="src" workdir="build/phpdox">
        <collector publiconly="false" backend="parser">
            <include mask="*.php"/>
            <exclude mask="*Autoload.php"/>
        </collector>
        <generator output="build">
            <build engine="html" enabled="true" output="api"/>
        </generator>
    </project>
</phpdox>

output:

EvilGenius:markii nate$ phpdox
phpDox 0.5.0 - Copyright (C) 2010 - 2013 by Arne Blankerts

[30.05.2013 - 20:43:14] Using config file '/Users/nate/Projects/Dishopinion/markii/phpdox.xml'
[30.05.2013 - 20:43:14] Registered collector backend 'parser'
[30.05.2013 - 20:43:14] Registered output engine 'html'
[30.05.2013 - 20:43:14] Registered output engine 'graph'
[30.05.2013 - 20:43:14] Registered output engine 'todo'
[30.05.2013 - 20:43:14] Starting to process project 'markii'
[30.05.2013 - 20:43:14] Starting collector


Oups... phpDox encountered a problem and has terminated!
It most likely means you've found a bug, so please file a report for this and paste the stacktrace (if given) along!

Exception: TheSeer\fDOM\fDOMException
Location: /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/fDOMDocument/fDOMDocument.php (Line 137)

loading file 'build/phpdox/source.xml' failed.

[/Users/nate/Projects/Dishopinion/markii/build/phpdox/source.xml] [Line: 2 - Column: 1] Fatal Error 4: Start tag expected, '<' not found


#0 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/project/Project.php(78): TheSeer\phpDox\Project\Project->initCollections()
#1 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/shared/Factory.php(235): TheSeer\phpDox\Project\Project->__construct()


Oups... phpDox encountered a problem and has terminated!
It most likely means you've found a bug, so please file a report for this and paste the stacktrace (if given) along!

Exception: ErrorException
Location: /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/shared/ErrorHandler.php (Line 137)

Undefined index: file

#0 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/shared/ErrorHandler.php(117): TheSeer\phpDox\ErrorHandler->renderException()
#1 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/CLI.php(165): TheSeer\phpDox\ErrorHandler->handleException()
#2 /usr/local/php5-5.3.25-20130520-141754/bin/phpdox(60): TheSeer\phpDox\CLI->run()
@theseer
Copy link
Owner

theseer commented May 30, 2013

This looks like phpDox tries to load a broken or empty source.xml file left from a probably crashed previous run. Can you remove the work directory ("build/phpdox") and give it another run?

The followup exception looks like a crash in the error handler. I'll look into that one for this is new.

@NathanielMichael
Copy link
Author

Removed the entire contents of the directory and continue to get the same error with source.xml.

Any chance it gets generated by something that breaks, and the process continues?

EvilGenius:markii nate$ rm -rf build/phpdox/*
EvilGenius:markii nate$ phpdox
phpDox 0.5.0 - Copyright (C) 2010 - 2013 by Arne Blankerts

[30.05.2013 - 23:12:41] Using config file '/Users/nate/Projects/Dishopinion/markii/phpdox.xml'
[30.05.2013 - 23:12:41] Registered collector backend 'parser'
[30.05.2013 - 23:12:41] Registered output engine 'html'
[30.05.2013 - 23:12:41] Registered output engine 'graph'
[30.05.2013 - 23:12:41] Registered output engine 'todo'
[30.05.2013 - 23:12:41] Starting to process project 'markii'
[30.05.2013 - 23:12:41] Starting collector
[30.05.2013 - 23:12:41] Scanning directory 'src' for files to process



[30.05.2013 - 23:12:41] Saving results to directory 'build/phpdox'
[30.05.2013 - 23:12:41] Collector process completed
[30.05.2013 - 23:12:41] Starting generator



Oups... phpDox encountered a problem and has terminated!
It most likely means you've found a bug, so please file a report for this and paste the stacktrace (if given) along!

Exception: TheSeer\fDOM\fDOMException
Location: /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/fDOMDocument/fDOMDocument.php (Line 137)

loading file 'build/phpdox/source.xml' failed.

[/Users/nate/Projects/Dishopinion/markii/build/phpdox/source.xml] [Line: 2 - Column: 1] Fatal Error 4: Start tag expected, '<' not found


#0 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/project/Project.php(78): TheSeer\phpDox\Project\Project->initCollections()
#1 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/Application.php(182): TheSeer\phpDox\Project\Project->__construct()
#2 /usr/local/php5-5.3.25-20130520-141754/lib/php/TheSeer/phpDox/CLI.php(136): TheSeer\phpDox\Application->runGenerator()
#3 /usr/local/php5-5.3.25-20130520-141754/bin/phpdox(60): TheSeer\phpDox\CLI->run()
EvilGenius:markii nate$ cat build/phpdox/source.xml 
<?xml version="1.0" encoding="utf-8"?>

@NathanielMichael
Copy link
Author

Another note, here are some contents of src/

EvilGenius:markii nate$ find src/ -name "*.php"
src//MarkII/Bundle/DashboardBundle/Controller/Admin/AdminController.php
src//MarkII/Bundle/DashboardBundle/Controller/Admin/AdminUserController.php
src//MarkII/Bundle/DashboardBundle/Controller/AuthController.php
src//MarkII/Bundle/DashboardBundle/Controller/DefaultController.php

@theseer
Copy link
Owner

theseer commented May 30, 2013

phpDox seems to have a hard time finding any actual source files. I'm a bit at a loss as to why, since using your phpdox.xml file and creating files in a directory structure like you posted, i do not get that problem.

As a side effect of this, you found a bug in my collecting process. While the index file is actually valid xml, the saved source.xml file is broken (causing the crash on the generator step) in case no files are found.

Is there a chance you can provide me with the php code you try to process - or a a small subset where the problem persists?

@NathanielMichael
Copy link
Author

That's really interesting... I'm getting the same behavior on my local machine (Mac OS X 10.8.3) and my CI server (Ubuntu 12.04).

Here's an excerpt...

src/MarkII/Bundle/DashboardBundle/DataFixtures/ORM/LoadUserData.php:

<?php

namespace MarkII\Bundle\DashboardBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use MarkII\Bundle\DashboardBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadUserData implements FixtureInterface, ContainerAwareInterface
{
    /**
     * @var ContainerInterface
     */
    private $container;

    /**
     * {@inheritDoc}
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }
}

@theseer
Copy link
Owner

theseer commented May 30, 2013

Bizarre...

From the files I created for testing, I get a working output on my devel maschine (Fedora 18, PHP 5.4.15) as well as on an older CenOS box (5.9, PHP 5.3.10):

theseer@nyda /tmp/issue-99 $ phpdox
phpDox 0.5.0 - Copyright (C) 2010 - 2013 by Arne Blankerts

[30.05.2013 - 23:53:20] Using config file '/tmp/issue-99/phpdox.xml'
[30.05.2013 - 23:53:20] Registered collector backend 'parser'
[30.05.2013 - 23:53:20] Registered output engine 'html'
[30.05.2013 - 23:53:20] Registered output engine 'graph'
[30.05.2013 - 23:53:20] Registered output engine 'todo'
[30.05.2013 - 23:53:20] Starting to process project 'markii'
[30.05.2013 - 23:53:20] Starting collector
[30.05.2013 - 23:53:20] Scanning directory 'src' for files to process

..... [5]

[30.05.2013 - 23:53:20] Saving results to directory 'build/phpdox'
[30.05.2013 - 23:53:20] Resolving inheritance

..... [5]

[30.05.2013 - 23:53:20] Collector process completed
[30.05.2013 - 23:53:20] Starting generator

................................ [32]

[30.05.2013 - 23:53:20] Triggering raw engines

[30.05.2013 - 23:53:20] Generator process completed
[30.05.2013 - 23:53:20] Processing project 'markii' completed.

Time: 0 seconds, Memory: 5.25Mb

@NathanielMichael
Copy link
Author

Alright, I'll do a bit more digging and see if I can come up with anything. Thanks for your help.

@theseer
Copy link
Owner

theseer commented May 30, 2013

Also tried an empty new issue99 folder:

bash-3.2# ll
total 4
-rw-rw-r-- 1 1000 1000 446 May 30 23:18 phpdox.xml
drwxr-xr-x 3 root root 19 May 31 00:12 src

There is only the php source excerpt you posted in there.

bash-3.2# phpdox
phpDox 0.5.0 - Copyright (C) 2010 - 2013 by Arne Blankerts

[31.05.2013 - 00:14:38] Using config file '/root/issue-99/phpdox.xml'
[31.05.2013 - 00:14:38] Registered collector backend 'parser'
[31.05.2013 - 00:14:38] Registered output engine 'html'
[31.05.2013 - 00:14:38] Registered output engine 'graph'
[31.05.2013 - 00:14:38] Registered output engine 'todo'
[31.05.2013 - 00:14:38] Starting to process project 'markii'
[31.05.2013 - 00:14:38] Starting collector
[31.05.2013 - 00:14:38] Scanning directory 'src' for files to process

. [1]

[31.05.2013 - 00:14:38] Saving results to directory 'build/phpdox'
[31.05.2013 - 00:14:38] Resolving inheritance

. [1]

[31.05.2013 - 00:14:38] Collector process completed
[31.05.2013 - 00:14:38] Starting generator

................ [16]

[31.05.2013 - 00:14:38] Triggering raw engines

[31.05.2013 - 00:14:38] Generator process completed
[31.05.2013 - 00:14:38] Processing project 'markii' completed.

Time: 0 seconds, Memory: 7.50Mb

@theseer
Copy link
Owner

theseer commented Jul 5, 2013

Do we have any update on this problem?

theseer added a commit that referenced this issue Jul 5, 2013
@ghost
Copy link

ghost commented Jul 15, 2013

I was experiencing a similar error, my logs had lots of these lines:

[15.07.2013 - 10:13:17]  - ./cli/services/callback_handler.php (Undefined variable: undefinedVariable)
[15.07.2013 - 10:13:17]  - ./cli/services/processupdates.php (Undefined variable: undefinedVariable)
[15.07.2013 - 10:13:17]  - ./cli/services/smsqueue_handler.php (Undefined variable: undefinedVariable)
[15.07.2013 - 10:13:17]  - ./cli/services/injector.php (Undefined variable: undefinedVariable)

After grepping everything, found the following snippet from the PHPParser package (PHPParser/PHPParser/Lexer.php, line 42) which was causing the source.xml not be written correctly:

protected function resetErrors() {
    // clear error_get_last() by forcing an undefined variable error
    @$undefinedVariable;
}

Changed it to:

protected function resetErrors() {
    // clear error_get_last() by forcing an undefined variable error
    @trigger_error("");
}

And now everything is working.

@JimminiKin
Copy link

@marlin-forbes Got the same problem with phpdox and xdebug enabled.

xdebug.scream flag completely disable the @ operator, hence the errors.

Commenting this flag in /etc/php5/cli/conf.d/xdebug.ini did the trick for me.

@theseer
Copy link
Owner

theseer commented Jul 27, 2013

Having xdebug enabled during execution of phpDox is not recommended as it has quite a drastic impact on performance and some options like the nesting level limitations can cause unexpected crashes.

@theseer
Copy link
Owner

theseer commented Jul 27, 2013

As a secondary side note, phpDox does not contain any error suppression itself though of course some of the libraries used my do so.

To counter the effects of the scream feature of xdebug as well as other potentially problematic settings, I just added some ini_set() calls to disable them during the execution of phpDox.
You can find the change with commit ec79141.

@Morgon
Copy link

Morgon commented Aug 5, 2013

Even with the XDebug changes, I'm getting a similar issue:

Oups... phpDox encountered a problem and has terminated!
It most likely means you've found a bug, so please file a report for this and paste the stacktrace (if given) along!

Exception: TheSeer\fDOM\fDOMException
Location: /path/to/website/vendor/theseer/fdomdocument/src/fDOMDocument.php (Line 141)

loading file 'build/logs/checkstyle.xml' failed.

[XML-STRING] [Line: 0 - Column: 0] Warning 1549: failed to load external entity "/path/to/website/build/logs/checkstyle.xml"

#0 /path/to/website/vendor/theseer/phpdox/src/generator/enricher/checkstyle/CheckStyle.php(19): TheSeer\phpDox\Generator\Enricher\CheckStyle->loadFindings()
#1 /path/to/website/vendor/theseer/phpdox/src/generator/enricher/Factory.php(44): TheSeer\phpDox\Generator\Enricher\CheckStyle->__construct()
#2 /path/to/website/vendor/theseer/phpdox/src/Application.php(189): TheSeer\phpDox\Generator\Enricher\Factory->getInstanceFor()
#3 /path/to/website/vendor/theseer/phpdox/src/CLI.php(134): TheSeer\phpDox\Application->runGenerator()
#4 /path/to/website/vendor/theseer/phpdox/composer/bin/phpdox(30): TheSeer\phpDox\CLI->run()

I'm directly using the options spit out from --skel... not really changing anything other than the source path and the output path.

PhpDox was installed via composer.

@macnewbold
Copy link

I'm getting a similar problem trying to run phpdox from a jenkins-php template job:

 [exec] [05.08.2013 - 16:31:40] Starting generator
 [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\fDOM\fDOMException
 [exec] Location: phar:///usr/bin/phpdox-0.5.phar/fDOMDocument-1.3.2/TheSeer/fDOMDocument/fDOMDocument.php (Line 137)
 [exec] 
 [exec] loading file '/templates/html/index.xsl' failed.
 [exec] 
 [exec] [XML-STRING] [Line: 0 - Column: 0] Warning 1549: failed to load external entity "/templates/html/index.xsl"
 [exec] 
 [exec] 
 [exec] #0 phar:///usr/bin/phpdox-0.5.phar/phpdox/generator/engine/html/Html.php(80): TheSeer\phpDox\Generator\Engine\AbstractEngine->getXSLTProcessor()
 [exec] #1 phar:///usr/bin/phpdox-0.5.phar/phpdox/generator/engine/html/Html.php(94): TheSeer\phpDox\Generator\Engine\Html->getXSLTProcessor()
 [exec] #2 phar:///usr/bin/phpdox-0.5.phar/phpdox/generator/engine/html/Html.php(76): TheSeer\phpDox\Generator\Engine\Html->buildStart()
 [exec] #3 phar:///usr/bin/phpdox-0.5.phar/phpdox/generator/Generator.php(151): TheSeer\phpDox\Generator\Engine\Html->handle()
 [exec] #4 phar:///usr/bin/phpdox-0.5.phar/phpdox/generator/Generator.php(133): TheSeer\phpDox\Generator\Generator->triggerEvent()
 [exec] #5 phar:///usr/bin/phpdox-0.5.phar/phpdox/Application.php(182): TheSeer\phpDox\Generator\Generator->run()
 [exec] #6 phar:///usr/bin/phpdox-0.5.phar/phpdox/CLI.php(136): TheSeer\phpDox\Application->runGenerator()
 [exec] #7 /usr/bin/phpdox-0.5.phar(406): TheSeer\phpDox\CLI->run()
 [exec] 
 [exec] 
 [exec] 
 [exec] Result: 1

@theseer
Copy link
Owner

theseer commented Aug 6, 2013

@macnewbold I opened a new bug for that since it has nothing to do with bug. As a workaround, remove the node from the config as in phar mode, phpDox will find its templates automagically.

@theseer
Copy link
Owner

theseer commented Aug 6, 2013

@Morgon You are trying to use enrichers with a default config. Enrichers are work in progress and will be shipped starting the 0.6 release. The path ""/path/to/website/build/logs/checkstyle.xml" looks invalid to me. As of now, the part "build/logs/checkstyle.xml" is hardcoded within the enricher, that will obviously change prior to release.

@theseer
Copy link
Owner

theseer commented Aug 6, 2013

I'm closing this issue since for the original problem there was no update.
If you experience a crash as well, please open a new bug. In case it's a duplicate, I'll merge them as needed.

@theseer theseer closed this as completed Aug 6, 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

5 participants