theseer / phpdox

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

Unknow Error, Please help for this #356

Closed anushkanz closed 5 years ago

anushkanz commented 5 years ago

phpDox 0.12.0-dev - Copyright (C) 2010 - 2019 by Arne Blankerts and Contributors

[19.03.2019 - 21:32:11] Using config file './phpdox.xml' [19.03.2019 - 21:32:11] Registered collector backend 'parser' [19.03.2019 - 21:32:11] Registered enricher 'build' [19.03.2019 - 21:32:11] Registered enricher 'git' [19.03.2019 - 21:32:11] Registered enricher 'checkstyle' [19.03.2019 - 21:32:11] Registered enricher 'phpcs' [19.03.2019 - 21:32:11] Registered enricher 'pmd' [19.03.2019 - 21:32:11] Registered enricher 'phpunit' [19.03.2019 - 21:32:11] Registered enricher 'phploc' [19.03.2019 - 21:32:11] Registered output engine 'xml' [19.03.2019 - 21:32:11] Registered output engine 'html' [19.03.2019 - 21:32:11] Starting to process project 'phpdox' [19.03.2019 - 21:32:11] Starting collector [19.03.2019 - 21:32:11] Scanning directory '/Applications/XAMPP/xamppfiles/htdocs/twilio' for files to process

.................................................. [50] .................................................. [100] .................................................. [150] .................................................. [200] .................................................. [250] .................................................. [300] .......f.......................................... [350] .................................................. [400] .................................................. [450] .................................................. [500] .................................................. [550] .................................................. [600] .....................................f.f...ffff... [650] f......

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.14 (Darwin) PHPDox Version: 0.12.0-dev Exception: TypeError (Code: 0) Location: /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/collector/project/SourceFile.php (Line 74)

Return value of TheSeer\phpDox\Collector\SourceFile::getSource() must be of the type string, null returned

0 /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/collector/Collector.php(101): TheSeer\phpDox\Collector\Backend\PHPParser->parse()

1 /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/collector/Collector.php(71): TheSeer\phpDox\Collector\Collector->processFile()

2 /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/Application.php(88): TheSeer\phpDox\Collector\Collector->run()

3 /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/CLI.php(120): TheSeer\phpDox\Application->runCollector()

4 /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/phpdox(68): TheSeer\phpDox\CLI->run()

theseer commented 5 years ago

On first glance, the crash seems to be related to the fact that some files failed parsing - as in all files with 'f' in the dotted output - and phpDox under PHP 7's strict types does not handle this properly.

That qualifies as a clear bug.

theseer commented 5 years ago

Looking at SourceFile::getSource() the only way this method can return null instead of a string is by having the included regex call fail - which PHP translates into not helpful null as a return value.

I changed the code to handle this situation - even though I have no idea on how to test for this as I cannot come up with a testcase that would trigger it.

I'll include this change into 0.12.1 and would like you to check what happens when run against your codebase. The issue is probably not fixed with this but the Regex Error Code - if any - might help debugging this further.

theseer commented 5 years ago

If you do not want to wait for 0.12.1, feel free to run a test against master.

anushkanz commented 5 years ago

Hey, I just compare my code and your master file, Both are same. But Still, have the same issue. Looking forward to see proper solution. Thanks

theseer commented 5 years ago

The change is in ab50417b74b590bd1eef7a61216a4a5c21a8e5d4. Again, this is not a fix per se but it catches the null and translates it into an exception.

anushkanz commented 5 years ago

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.14 (Darwin) PHPDox Version: 0.12.0-dev ErrorException: E_ERROR Location: /Applications/XAMPP/xamppfiles/htdocs/twilio/vendor/theseer/phpdox/src/collector/project/Tokenizer.php (Line 116)

Allowed memory size of 134217728 bytes exhausted (tried to allocate 3401200 bytes)

No stacktrace available

I can see its used all the memory I allocated. But there is another error I can see before that happen. If any chance you can help to fix that its really appreciated Thanks

anushkanz commented 5 years ago

Found this answer, I am working on Laravel project I accidentally add vendor folder so I remove that from scanning list. Now it's working fine Thanks