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

Filename too long #351

Open aroly opened 5 years ago

aroly commented 5 years ago

Hi there,

I'm trying to generate doc for a PHP framework, and I'm facing the following 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 following details and the stacktrace (if given) along:

PHP Version: 7.0.33-0ubuntu0.16.04.1 (Linux)
PHPDox Version: 0.8.2-dev
Exception: TheSeer\phpDox\Collector\ProjectException (Code: 4)
Location: /usr/share/php/TheSeer/phpDox/collector/project/Project.php (Line 256)

An error occured while saving the collected data: DOMDocument::save(/home/XXX/OCI-P/broadworks-connector/vendor/cwm/broadworks-connector/build/phpdox/xml/classes/CWM_BroadWorksConnector_Ocip_Models_SystemVoiceMessagingGroupGetVoicePortalMenusResponse18sp1ChangeCurrentIntroductionOrMessageOrReplyMenuKeys.xml): failed to open stream: File name too long

#0 /usr/share/php/TheSeer/phpDox/CLI.php(161): TheSeer\phpDox\Application->runCollector()
#1 /usr/bin/phpdox(50): TheSeer\phpDox\CLI->run()

ErrorException: E_WARNING 
Location: /usr/share/php/TheSeer/fDOMDocument/fDOMDocument.php (Line 238)

DOMDocument::save(/home/XXX/OCI-P/broadworks-connector/vendor/cwm/broadworks-connector/build/phpdox/xml/classes/CWM_BroadWorksConnector_Ocip_Models_SystemVoiceMessagingGroupGetVoicePortalMenusResponse18sp1ChangeCurrentIntroductionOrMessageOrReplyMenuKeys.xml): failed to open stream: File name too long

#0 /usr/share/php/TheSeer/fDOMDocument/fDOMDocument.php(238): DOMDocument->save()
#1 /usr/share/php/TheSeer/phpDox/collector/project/Project.php(308): TheSeer\fDOM\fDOMDocument->save()
#2 /usr/share/php/TheSeer/phpDox/collector/project/Project.php(243): TheSeer\phpDox\Collector\Project->saveUnit()
#3 /usr/share/php/TheSeer/phpDox/Application.php(141): TheSeer\phpDox\Collector\Project->save()
#4 /usr/share/php/TheSeer/phpDox/CLI.php(161): TheSeer\phpDox\Application->runCollector()
#5 /usr/bin/phpdox(50): TheSeer\phpDox\CLI->run()

The filename generated is indeed too long for my Linux system, the max size is 255. I know that such long names are unusual, but you may want to have a look.

By the way, is there a way to somehow limit the filename length ? Or to trim a part, or anything ? I'd like to be able to generate this doc...

Regards,

A

theseer commented 5 years ago

It never occurred to me that the approach the current implementation takes - as in takeing the FQCN and basically mapping it 1:1 to a filename - might run over 255 chars. But of course that could easily happen and thus needs fixing.

The following solutions come to mind:

Unless somebody comes up with a better solution, I'll consider using the SHA-Approach.