theseer / phpdox

Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML and XSLT)
http://phpdox.de
Other
599 stars 121 forks source link

Token Exception missing file #271

Closed novacp closed 5 years ago

novacp commented 8 years ago

I was trying to run phpdox on windows server 2012 - but I am getting the error:

PHP Version: 7.0.5 (WINNT) PHPDox Version: 0.8.1.1 Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1) Location: phar://D:/htdocs/AscPro/bin/phpdox-0.8.1.1.phar/phpdox/generator/pro ject/TokenFile.php (Line 19)

File 'file:/D:/htdocs/AscPro/build/phpdox/tokens/AppBundle/AppBundle.php.xml' not found

I've checked the location, the file is not missing. I'm running into this problem during continuous integration process with jenkins. It is very strange, because the same phpdox version did work for me on ubuntu. Maybe this is related to the fact, that all programs lay on "C:", including Jenkins - but the workspace lays on "D:"? Or is this a bug?

theseer commented 6 years ago

Looks like I have to actually setup a Windows VM again to debug this further. I'm relatively sure this is related to the drive letter and the file uri.

eric-reichenbach commented 6 years ago

Hello, I've the same issue, I applied a quick and dirty fix locally to make it work by replacing file:/ with file:/// in the $path variable in the current() function of the TokenFileIterator class.

spresnac commented 6 years ago

Same here, Windows 10, phpdox 0.11.2 Can not install with composer and .phar responses that error above! Still open for over half a year ...

theseer commented 6 years ago

As stated before, I do not use windows. To debug this, I restored a Windows 10 VM in Virtualbox. I tried my local phpdox code base as well as the 0.11.2 release phar using the following PHP Versions:

I still fail to reproduce this.

Output from PHP 7.0.8 and phar of 0.11.2 processing phpdox' own code base:

C:\Users\TheSeer\Desktop\phpdox>c:\PHP-7.0.8\php.exe ..\phpdox-0.11.2.phar
phpDox 0.11.2 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors

[21.08.2018 - 20:22:07] Using config file './phpdox.xml.dist'
[21.08.2018 - 20:22:07] Registered collector backend 'parser'
[21.08.2018 - 20:22:07] Registered enricher 'build'
[21.08.2018 - 20:22:07] Registered enricher 'git'
[21.08.2018 - 20:22:07] Registered enricher 'checkstyle'
[21.08.2018 - 20:22:07] Registered enricher 'phpcs'
[21.08.2018 - 20:22:07] Registered enricher 'pmd'
[21.08.2018 - 20:22:07] Registered enricher 'phpunit'
[21.08.2018 - 20:22:07] Registered enricher 'phploc'
[21.08.2018 - 20:22:07] Registered output engine 'xml'
[21.08.2018 - 20:22:07] Registered output engine 'html'
[21.08.2018 - 20:22:07] Starting to process project 'phpDox'
[21.08.2018 - 20:22:07] Starting collector
[21.08.2018 - 20:22:07] Scanning directory 'C:/Users/TheSeer/Desktop/phpdox/src' for files to process

..................................................      [50]
..................................................      [100]
..................................................      [150]
..................................................      [200]
.....                                                   [205]

[21.08.2018 - 20:22:11] Saving results to directory 'C:/Users/TheSeer/Desktop/phpdox/build/api/xml'
[21.08.2018 - 20:22:16] Resolving inheritance

..................................................      [50]
..................................................      [100]
..................................................      [150]
..................................................      [200]
.............                                           [213]

[21.08.2018 - 20:22:17] The following unit(s) had missing dependencies during inheritance resolution:
[21.08.2018 - 20:22:17]  - TheSeer\phpDox\Collector\Backend\CustomLexer (missing PhpParser\Lexer\Emulative)
[21.08.2018 - 20:22:17]  - TheSeer\phpDox\Collector\Backend\PublicOnlyVisitor (missing PhpParser\NodeVisitorAbstract)
[21.08.2018 - 20:22:17]  - TheSeer\phpDox\Collector\Backend\UnitCollectingVisitor (missing PhpParser\NodeVisitorAbstract)
[21.08.2018 - 20:22:18] Collector process completed

[21.08.2018 - 20:22:18] Starting generator
[21.08.2018 - 20:22:18] Loading enrichers
[21.08.2018 - 20:22:18] Enricher Build Information initialized successfully
[21.08.2018 - 20:22:18] Enricher GIT information initialized successfully
[21.08.2018 - 20:22:18] Enricher CheckStyle XML initialized successfully
[21.08.2018 - 20:22:18] Enricher PHPMessDetector XML initialized successfully
[21.08.2018 - 20:22:18] Enricher PHPLoc xml initialized successfully
[21.08.2018 - 20:22:18] Enricher PHPUnit Coverage XML initialized successfully
[21.08.2018 - 20:22:18] Starting event loop.

..................................................      [50]
..................................................      [100]
..................................................      [150]
[ ... ]
..................................................      [2000]
..................................................      [2050]
..................................................      [2100]
...............................                         [2131]

[21.08.2018 - 20:24:03] Generator process completed
[21.08.2018 - 20:24:03] Processing project 'phpDox' completed.

Time: 1.93 minutes, Memory: 10.00MB

C:\Users\TheSeer\Desktop\phpdox>

It's slow (probably due to the slow VM disc I/O) but completes just fine. Also rerunning it from cache works.

What do I have to do to reproduce this?

spresnac commented 6 years ago

Hej @theseer , maybe some more information guide you. I have Win10 with XAMPP running PHP 7.2 I installed laravel (5.6) with dependencies:

D:\xampp\htdocs\hpm_api>composer show barryvdh/laravel-ide-helper v2.4.3 Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve au... barryvdh/reflection-docblock v2.0.4 beyondcode/laravel-er-diagram-generator 1.2.0 Generate ER diagrams from your Laravel models. defuse/php-encryption v2.2.1 Secure PHP Encryption Library dnoegel/php-xdg-base-dir 0.1 implementation of xdg base directory specification for php doctrine/annotations v1.6.0 Docblock Annotations Parser doctrine/cache v1.7.1 Caching library offering an object-oriented API for many cache backends doctrine/dbal v2.8.0 Database Abstraction Layer doctrine/event-manager v1.0.0 Doctrine Event Manager component doctrine/inflector v1.3.0 Common String Manipulations with regard to casing and singular/plural rules. doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate objects in PHP without invoking their c... doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. dragonmantank/cron-expression v2.2.0 CRON for PHP: Calculate the next or previous run date and determine if a CRON expre... egulias/email-validator 2.1.5 A library for validating emails against several RFCs erusev/parsedown 1.7.1 Parser for Markdown. fideloper/proxy 4.0.0 Set trusted proxies for Laravel filp/whoops 2.2.0 php error handling for cool kids firebase/php-jwt v5.0.0 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform ... fzaninotto/faker v1.8.0 Faker is a PHP library that generates fake data for you. guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP client library guzzlehttp/promises v1.3.1 Guzzle promises library guzzlehttp/psr7 1.4.2 PSR-7 message implementation that also provides common utility methods hamcrest/hamcrest-php v2.0.0 This is the PHP port of Hamcrest Matchers jakub-onderka/php-console-color 0.1 jakub-onderka/php-console-highlighter v0.3.2 laravel/framework v5.6.33 The Laravel Framework. laravel/passport v6.0.7 Laravel Passport provides OAuth2 server support to Laravel. laravel/tinker v1.0.7 Powerful REPL for the Laravel framework. lcobucci/jwt 3.2.4 A simple library to work with JSON Web Token and JSON Web Signature league/event 2.1.2 Event package league/flysystem 1.0.45 Filesystem abstraction: Many filesystems, one API. league/oauth2-server 7.2.0 A lightweight and powerful OAuth 2.0 authorization and resource server library with... mockery/mockery 1.1.0 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 1.23.0 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.8.1 Create deep copies (clones) of your objects nesbot/carbon 1.25.0 A simple API extension for DateTime. nikic/php-parser v4.0.3 A PHP parser written in PHP nunomaduro/collision v2.0.3 Cli error handling for console/command-line PHP applications. paragonie/random_compat v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 phar-io/manifest 1.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 2.0.1 Library for handling version information and constraints phpdocumentor/graphviz 1.0.4 phpdocumentor/reflection-common 1.0.1 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 4.3.0 With this component, a library can provide support for annotations via DocBlocks or... phpdocumentor/type-resolver 0.4.0 phpseclib/phpseclib 2.0.11 PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFT... phpspec/prophecy 1.8.0 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 6.0.7 Library that provides collection, processing, and rendering functionality for PHP c... phpunit/php-file-iterator 2.0.1 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 2.0.0 Utility class for timing phpunit/php-token-stream 3.0.0 Wrapper around PHP's tokenizer extension. phpunit/phpunit 7.3.1 The PHP Unit Testing framework. psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11) psr/http-message 1.0.1 Common interface for HTTP messages psr/log 1.0.2 Common interface for logging libraries psr/simple-cache 1.0.1 Common interfaces for simple caching psy/psysh v0.9.7 An interactive shell for modern PHP. ramsey/uuid 3.8.0 Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, ... sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 3.0.2 Provides the functionality to compare PHP values for equality sebastian/diff 3.0.1 Diff implementation sebastian/environment 3.1.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 3.1.0 Provides the functionality to export PHP variables for visualization sebastian/global-state 2.0.0 Snapshotting of global state sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP variables sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted PHP projects swiftmailer/swiftmailer v6.1.2 Swiftmailer, free feature-rich PHP mailer symfony/class-loader v3.4.14 Symfony ClassLoader Component symfony/console v4.1.3 Symfony Console Component symfony/css-selector v4.1.3 Symfony CssSelector Component symfony/debug v4.1.3 Symfony Debug Component symfony/event-dispatcher v4.1.3 Symfony EventDispatcher Component symfony/finder v4.1.3 Symfony Finder Component symfony/http-foundation v4.1.3 Symfony HttpFoundation Component symfony/http-kernel v4.1.3 Symfony HttpKernel Component symfony/polyfill-ctype v1.9.0 Symfony polyfill for ctype functions symfony/polyfill-mbstring v1.9.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.9.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/process v4.1.3 Symfony Process Component symfony/psr-http-message-bridge v1.0.2 PSR HTTP message bridge symfony/routing v4.1.3 Symfony Routing Component symfony/translation v4.1.3 Symfony Translation Component symfony/var-dumper v4.1.3 Symfony mechanism for exploring and dumping PHP variables symfony/yaml v4.1.3 Symfony Yaml Component theseer/tokenizer 1.1.0 A small library for converting tokenized PHP source code into XML and potentially o... tijsverkoyen/css-to-inline-styles 2.2.1 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML... vlucas/phpdotenv v2.5.1 Loads environment variables from .env to getenv(), $_ENV and $_SERVER autom... webmozart/assert 1.3.0 Assertions to validate method input/output with nice error messages. zendframework/zend-diactoros 1.8.5 PSR HTTP Message implementations zircote/swagger-php 3.0.0 swagger-php - Generate interactive documentation for your RESTful API using phpdoc ...

Now, when trying to "composer require --dev theseer/phpdox", i get this error:

D:\xampp\htdocs\hpm_api>composer require --dev theseer/phpdox Using version ^0.11.2 for theseer/phpdox ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for theseer/phpdox ^0.11.2 -> satisfiable by theseer/phpdox[0.11.2].
  • Conclusion: remove nikic/php-parser v4.0.3
  • Conclusion: don't install nikic/php-parser v4.0.3
  • theseer/phpdox 0.11.2 requires nikic/php-parser ^3.1 -> satisfiable by nikic/php-parser[3.x-dev, v3.1.0, v3.1.1, v3.1.2, v3.1.3, v3. 1.4, v3.1.5].
  • Can only install one of: nikic/php-parser[3.x-dev, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.0, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.1, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.2, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.3, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.4, v4.0.3].
  • Can only install one of: nikic/php-parser[v3.1.5, v4.0.3].
  • Installation request for nikic/php-parser (locked at v4.0.3) -> satisfiable by nikic/php-parser[v4.0.3].

Installation failed, reverting ./composer.json to its original content.

The phpdox.phar generates the above error when trying to use the generator, the collector is running well, only on "php build\tools\phpdox.phar -g" it goes like:

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 following details and the stacktrace (if given) along:

PHP Version: 7.2.7 (WINNT) PHPDox Version: 0.11.2 Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1) Location: phar://D:/xampp/htdocs/hpm_api/build/tools/phpdox.phar/phpdox/generator/project/TokenFile.php (Line 19)

File 'file:/D:/xampp/htdocs/hpm_api/build/phpdox/tokens/Console/Kernel.php.xml' not found

0 phar://D:/xampp/htdocs/hpm_api/build/tools/phpdox.phar/phpdox/generator/Generator.php(147): TheSeer\phpDox\Generator\TokenFileIterator-

current()

1 phar://D:/xampp/htdocs/hpm_api/build/tools/phpdox.phar/phpdox/generator/Generator.php(140): TheSeer\phpDox\Generator\Generator->process

TokenFiles()

2 phar://D:/xampp/htdocs/hpm_api/build/tools/phpdox.phar/phpdox/Application.php(246): TheSeer\phpDox\Generator\Generator->run()

3 phar://D:/xampp/htdocs/hpm_api/build/tools/phpdox.phar/phpdox/CLI.php(165): TheSeer\phpDox\Application->runGenerator()

4 D:\xampp\htdocs\hpm_api\build\tools\phpdox.phar(470): TheSeer\phpDox\CLI->run()

So, in my optionen, there are 2 todos:

  1. Get the composer running with newest configurations and
  2. remove the drive letter, when running on windows (real_path could be a fix for that).

Regards....

theseer commented 6 years ago

Hi,

thanks for the pointers. Do you have a project I can simply clone to reproduce this?

Regarding your two todos:

  1. Get the composer running with newest configurations

This is currently a "Won't fix" as PHP-Parser 4.x does not run under PHP 5.6. Since phpDox - at least the 0.11.x-Series - is bound to run with PHP 5.6, I can't change that yet. I certainly will update it to PHP-Parser 4 for the next version.

On a related note: I don't care about composer install-ability of phpDox. You're not supposed to mangle dependencies of various tools and your own software into one installable set. Use phars for tools and you don't have a problem.

  1. remove the drive letter, when running on windows (real_path could be a fix for that).

Windows for maybe historic reasons loves drive letters. There is no way a drive letter can be removed from a path and it would still work. The problem rather seems to be the arcane syntax with file:///X:/foo ...

The hack by @EricReichenbach replacing file:/X: with file:///X: makes a lot of sense because file:/X: would not be a valid path. Thing though is, I don't get file:/X: when running it on my Windows VM. And for me, it doesn't crash either.

I'm a bit reluctant to make a change in the code that I cannot see the result from ;)

theseer commented 6 years ago

Still trying to reproduce this.

Next attempt with a default laraval sample project (blog), following the documented way of installation:

composer create-project --prefer-dist laravel/laravel blog

Create two phpdox configruations, one for the app itself and one for the framework as dependency:

phpdox --skel --strip > vendor.xml
phpdox --skel --strip > phpdox.xml.dist

Adjusted them so they look as this:

cat vendor.xml

<?xml version="1.0" encoding="utf-8"?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
  <project name="vendor" source="${basedir}/vendor" workdir="${basedir}/build/phpdox/vendor">
    <collector publiconly="false" backend="parser" encoding="auto">
      <include mask="*.php"/>
      <exclude mask="*test*"/>
      <exclude mask="*Tests*"/>
      <inheritance resolve="true"/>
    </collector>
  </project>
</phpdox>

cat phpdox.xml.dist

<?xml version="1.0" encoding="utf-8"?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
  <project name="phpdox" source="${basedir}/app" workdir="${basedir}/build/phpdox/xml">
    <collector publiconly="false" backend="parser" encoding="auto">
      <include mask="*.php"/>
      <exclude mask=""/>
      <inheritance resolve="true">
        <dependency path="${basedir}/build/phpdox/vendor" />
      </inheritance>
    </collector>
    <generator output="${basedir}/docs">
      <enrich base="${basedir}/build"/>
      <build engine="html" enabled="true" output="html">
        <template dir="${phpDox.home}/templates/html"/>
        <file extension="xhtml"/>
      </build>
    </generator>
  </project>
</phpdox>

Run phpdox for vendor in collector only mode:

Y:\xx\blog>php tools\phpdox -f vendor.xml -c
phpDox 0.11.2 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors

[22.08.2018 - 11:15:07] Using config file 'vendor.xml'
[22.08.2018 - 11:15:07] Registered collector backend 'parser'
[22.08.2018 - 11:15:07] Registered enricher 'build'
[22.08.2018 - 11:15:07] Registered enricher 'git'
[22.08.2018 - 11:15:07] Registered enricher 'checkstyle'
[22.08.2018 - 11:15:07] Registered enricher 'phpcs'
[22.08.2018 - 11:15:07] Registered enricher 'pmd'
[22.08.2018 - 11:15:07] Registered enricher 'phpunit'
[22.08.2018 - 11:15:07] Registered enricher 'phploc'
[22.08.2018 - 11:15:07] Registered output engine 'xml'
[22.08.2018 - 11:15:07] Registered output engine 'html'
[22.08.2018 - 11:15:07] Starting to process project 'phpdox'
[22.08.2018 - 11:15:07] Starting collector
[22.08.2018 - 11:15:07] Scanning directory 'Y:/xx/blog/vendor' for files to process

..................................................      [50]
..................................................      [100]
..................................................      [150]
..................................................      [200]

[...]

..................................................      [3350]
..................................................      [3400]
..............................................f...      [3450]
..................................................      [3500]
....................                                    [3520]

[22.08.2018 - 11:18:08] The following file(s) had errors during processing and were excluded:
[22.08.2018 - 11:18:08]  - Y:/xx/blog/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php (Undefined property: PhpParser\Node\Stmt\Class_::$namespacedName [UnitCollectingVisitor.php:117])

[...]

[22.08.2018 - 11:18:08]  - Y:/xx/blog/vendor/symfony/var-dumper/Server/DumpServer.php (get_class() expects parameter 1 to be object, string given [UnitCollectingVisitor.php:320])
[22.08.2018 - 11:18:08] Saving results to directory 'Y:/xx/blog/build/phpdox/vendor'
[22.08.2018 - 11:20:36] Resolving inheritance

..................................................      [50]
..................................................      [100]
..................................................      [150]

[...]

..................................................      [3450]
..................................................      [3500]
.................................                       [3533]

[22.08.2018 - 11:21:54] The following unit(s) had missing dependencies during inheritance resolution:
[22.08.2018 - 11:21:54]  - Mockery\Adapter\Phpunit\TestListener (missing PHPUnit\Framework\BaseTestListener)
[22.08.2018 - 11:21:54]  - Symfony\Component\Routing\Loader\AnnotationFileLoader (missing Symfony\Component\Config\Loader\FileLoader)

[...]

[22.08.2018 - 11:21:54]  - Symfony\Component\Routing\Loader\AnnotationDirectoryLoader (missing Symfony\Component\Config\Loader\FileLoader)
[22.08.2018 - 11:21:54]  - Symfony\Component\Routing\Loader\AnnotationClassLoader (missing Symfony\Component\Config\Loader\LoaderInterface)
[22.08.2018 - 11:21:54] Collector process completed

[22.08.2018 - 11:21:54] Processing project 'phpdox' completed.

Time: 6.79 minutes, Memory: 94.00MB

And finally, running the main thing:

Y:\xx\blog>php tools\phpdox
phpDox 0.11.2 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors

[22.08.2018 - 10:37:21] Using config file './phpdox.xml'
[22.08.2018 - 10:37:21] Registered collector backend 'parser'
[22.08.2018 - 10:37:21] Registered enricher 'build'
[22.08.2018 - 10:37:21] Registered enricher 'git'
[22.08.2018 - 10:37:21] Registered enricher 'checkstyle'
[22.08.2018 - 10:37:21] Registered enricher 'phpcs'
[22.08.2018 - 10:37:21] Registered enricher 'pmd'
[22.08.2018 - 10:37:21] Registered enricher 'phpunit'
[22.08.2018 - 10:37:21] Registered enricher 'phploc'
[22.08.2018 - 10:37:21] Registered output engine 'xml'
[22.08.2018 - 10:37:21] Registered output engine 'html'
[22.08.2018 - 10:37:21] Starting to process project 'phpdox'
[22.08.2018 - 10:37:21] Starting collector
[22.08.2018 - 10:37:21] Scanning directory 'Y:/xx/blog/app' for files to process

....................                                    [20]

[22.08.2018 - 10:37:23] Saving results to directory 'Y:/xx/blog/build/phpdox/xml'
[22.08.2018 - 10:37:23] Resolving inheritance

....................                                    [20]

[22.08.2018 - 10:37:25] Collector process completed

[22.08.2018 - 10:37:25] Starting generator
[22.08.2018 - 10:37:25] Loading enrichers
[22.08.2018 - 10:37:25] Enricher Build Information initialized successfully
[22.08.2018 - 10:37:25] Starting event loop.

..................................................      [50]
..................................................      [100]
..................................................      [150]
..................................................      [200]

[...]

..................................................      [1000]
..................................................      [1050]
.........................                               [1075]

[22.08.2018 - 10:37:33] Generator process completed
[22.08.2018 - 10:37:33] Processing project 'phpdox' completed.

Time: 12.55 seconds, Memory: 8.00MB

Y:\xx\blog>

Again, I fail to reproduce this issue. What am I doing wrong?

spresnac commented 6 years ago

Glad you post such much information. I modified my "phpdox.xml" so i can use phpdox now without problems.

I do not know, what exacly was wrong, but here is the "original" phpdox.xml, what was not working.

<phpdox xmlns="http://xml.phpdox.net/config">
    <project name="PName" source="app" workdir="build/phpdox">
        <collector publiconly="false">
            <include mask="*.php" />
        </collector>

        <generator output="build">
            <build engine="html" enabled="true" output="api">
                <file extension="html" />
            </build>
        </generator>
    </project>
</phpdox>

With the "phpdox.xml.dist" you pasted above, it all works well. Maybe you have trouble with my old version too?

Thankfull for your help...

theseer commented 6 years ago

Yay!

[22.08.2018 - 12:03:32] Starting event loop.

..................................................      [50]
..................................................      [100]
...............................................

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 following details and the stacktrace (if given) along:

PHP Version: 7.2.5 (WINNT)
PHPDox Version: 0.11.2
Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1)
Location: phar://Y:/xx/blog/tools/phpdox/phpdox/generator/project/TokenFile.php (Line 19)

File 'file:/Y:/xx/blog/build/phpdox/tokens/User.php.xml' not found

#0 phar://Y:/xx/blog/tools/phpdox/phpdox/generator/Generator.php(147): TheSeer\phpDox\Generator\TokenFileIterator->current()
#1 phar://Y:/xx/blog/tools/phpdox/phpdox/generator/Generator.php(140): TheSeer\phpDox\Generator\Generator->processTokenFiles()
#2 phar://Y:/xx/blog/tools/phpdox/phpdox/Application.php(246): TheSeer\phpDox\Generator\Generator->run()
#3 phar://Y:/xx/blog/tools/phpdox/phpdox/CLI.php(165): TheSeer\phpDox\Application->runGenerator()
#4 Y:\xx\blog\tools\phpdox(470): TheSeer\phpDox\CLI->run()

Finally :-)

Okay, now let's try to understand why that actually happens and how the f***k the configuration difference can be the cause.

Thanks!

spresnac commented 6 years ago

Glad i can help 😄

theseer commented 6 years ago

The only relevant difference is the value of the workdir attribute on the project node.

In your config.xml:

<project name="PName" source="app" workdir="build/phpdox">

vs.

In mine:

<project name="PName" source="app" workdir="${basedir}/build/phpdox">

Interesting...

knallcharge commented 5 years ago

I have been playing around with the paths in my config now for a couple of hours, but still to no avail, the error remains:

13:32:24    [phpdox] PHP Version: 7.1.19 (WINNT)
13:32:24    [phpdox] PHPDox Version: 0.11.2
13:32:24    [phpdox] Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1)
13:32:24    [phpdox] Location: phar://C:/bin/phpdox.phar/phpdox/generator/project/TokenFile.php (Line 19)
13:32:24    [phpdox] 
13:32:24    [phpdox] File 'file:/C:/Program Files (x86)/Jenkins/jobs/eCommerce WebShop/workspace/build/phpdox/xml/tokens/classes/Builder/UpdateShopConfigCacheBuilder.class.php.xml' not found
13:32:24    [phpdox] 
13:32:24    [phpdox] #0 phar://C:/bin/phpdox.phar/phpdox/generator/Generator.php(147): TheSeer\phpDox\Generator\TokenFileIterator->current()
13:32:24    [phpdox] #1 phar://C:/bin/phpdox.phar/phpdox/generator/Generator.php(140): TheSeer\phpDox\Generator\Generator->processTokenFiles()
13:32:24    [phpdox] #2 phar://C:/bin/phpdox.phar/phpdox/Application.php(246): TheSeer\phpDox\Generator\Generator->run()
13:32:24    [phpdox] #3 phar://C:/bin/phpdox.phar/phpdox/CLI.php(165): TheSeer\phpDox\Application->runGenerator()
13:32:24    [phpdox] #4 C:\bin\phpdox.phar(470): TheSeer\phpDox\CLI->run()

The file "file:/C:/Program Files..." exists, but can't be found by phpdox, also I'm using the phar-file, so there's no way to apply the mentioned hack to get file:///.

[Modified by @theseer for readability]

theseer commented 5 years ago

@Knallcharge Can you paste the <project> node of your phpdox.xml file? I'm particularly interested in the workdir attribute value...

knallcharge commented 5 years ago

@theseer Thanks for getting back, here you go:

<project name="myproject" source="${basedir}/../modules" workdir="${basedir}/phpdox/xml">
    <collector publiconly="false" backend="parser" encoding="auto">
      <include mask="*/mymodules*/**.php"/>
      <exclude mask="*Autoload.php"/>
      <inheritance resolve="true">
        <dependency path="${basedir}/phpdox/vendor" />
      </inheritance>
    </collector>
    <generator output="${basedir}/docs">
      <enrich base="${basedir}"/>
      <build engine="html" enabled="true" output="html">
        <template dir="${phpDox.home}/templates/html"/>
        <file extension="xhtml"/>
      </build>
    </generator>
  </project>

I've tried just "phpdox/xml" as my workdir, but the error remains.

theseer commented 5 years ago

@Knallcharge Your problem is caused by the path containing spaces.

If I setup a test-system on a windows 10 VM with spaces i can reproduce your issue. Rather curious, since I considered that problem fixed.

Looks like i have to look into how I handle path's more than I thought...

theseer commented 5 years ago

Okay, for whatever reason and on windows only $dom->documentUri under some conditions I don't fully understand, the path returned is prefixed with file:/ which confuses the rest of phpDox.

This does not happen on Linux or macOS as far as I can tell.

As a potentially temporary solution, the prefix of file:/ is stripped before the path is returned. This seems to fix the problem for both testcases on my systems.

theseer commented 5 years ago

@spresnac, @Knallcharge Can you verify if that works with a custom build of master?

knallcharge commented 5 years ago

@theseer Thanks for looking into this. I'm now getting a different error but I blame it on my custom phar (never build one before):

[phpdox] PHP Version: 7.1.19 (WINNT)
[phpdox] PHPDox Version: 0.12.0-dev
[phpdox] Exception: TheSeer\fDOM\fDOMException (Code: 1)
[phpdox] Location: phar://C:/bin/phpdox.phar/vendor/theseer/fdomdocument/src/fDOMDocument.php (Line 147)
[phpdox] 
[phpdox] loading file 'phar%3A//C%3A/bin/phpdox.phar/templates/html/components.xsl' failed.
theseer commented 5 years ago

That might have actually been a side effect I didn't test for.

I'll have a look.

theseer commented 5 years ago

I cannot reproduce that on my Win10 VM.

I attached a phar to this comment. Given Github doesn't like phars as an attachment here, I had to gzip it. So before running, please gzip -d it.

phpdox-0.12.0-dev-12-g68d0124.phar.gz

knallcharge commented 5 years ago

That did the trick, thanks a bunch!

[phpdox] [04.02.2019 - 14:55:00] Generator process completed
[phpdox] [04.02.2019 - 14:55:00] Processing project 'shop' completed.

Results are not showing in my Jenkins, but that's a different story :)