Phpdocumentor: Invalid paths about source files

Created on 8 Aug 2014  Â·  11Comments  Â·  Source: phpDocumentor/phpDocumentor

I have an issue with the version 2.6.1, the path of my source files are wrong

wrong path : docs/files/Api%2FAbstractGeocachingApi.php.txt
and I fixed it by creating the directory "Api" and move the file :
right path : docs/files/Api.AbstractGeocachingApi.php.txt

You can reproduce the bug with this repository: https://github.com/Surfoo/geocaching-api

bug template

Most helpful comment

Nevermind, I found the problem by looking in the JavaScript Console:

XMLHttpRequest cannot load file:///home/foo/docs/output/files/Utilities.php.txt. Cross origin requests are only supported for HTTP.

So I started a small http-server and tried the source code links again. It works. Excellent! Sorry for the wrong report above. I hope my tip helps others too.

All 11 comments

Thanks for reporting this issue @Surfoo. I have marked it as a bug to be fixed.

Most probably a |raw filter needs to be added in the Clean template's file part where it links to the sources

This is fixed in https://github.com/phpDocumentor/template.clean/issues/43 and will be included in the next release. Thank you for reporting this issue

Hi, I have same problem...
I'm using phpDocumentor (version 2.6.1) for symfony2 project on ubuntu ...
| raw is not the fix for it .... (issue is not in the link to the file , but in the file name and file path)
I have found that cause of this problem is in vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Plugin/Twig/Writer/Twig.php on line 297
...
// make it windows proof
$filepart = urlencode(iconv('UTF-8', 'ASCII//TRANSLIT', $filepart));
...
I hope this helps fixing the issue ...

Indeed, I just applied the commit and the bug is still here.
In my case, generated files are still :

  • docs/files/Api%2FAbstractGeocachingApi.php.txt
  • docs/files/Api%2FGeocachingApi.php.txt
  • docs/files/OAuth%2FOAuth.php.txt

I commented the line quoted by m-ciric, and it works..

I have the same problem:
files in folder "files"
docs/files/AccountBundle%5CController%5CAccountController.php.txt
docs/files/AccountBundle%5CForm%5CHandler%5CAccountHandler.php.txt
docs/files/CaseBundle%5CController%5CApi%5CSoap%5CCaseController.php.txt
...

if I click view source i see:
✖ Error 404 while fetching file: Not Found

in console:
Failed to load resource: the server responded with a status of 404 (Not Found) http://myhost.com/docs/files/CaseBundle/Controller/Api/Soap/CaseController.php.txt

Unfortunately that line cannot be removed due to windows compatibility; I am going to write a workaround that first splits the path by its parts and applies the encoding on the specific bits

I think you can fix this, in template.clean (phpDocumentor 2.7.0), by changing the class.html.twig to look like this in line 321:

<pre data-src="{{ path('files/' ~ node.path|url_encode(true) ~ '.txt')|raw }}" class="language-php line-numbers"></pre>

Same error here, the @L3CC code doesn't fix it.

Any updates on this issue ?

This is still a problem. The .txt files with source code for classes get generated. But the clean template doesn't link properly to them. :-(

Nevermind, I found the problem by looking in the JavaScript Console:

XMLHttpRequest cannot load file:///home/foo/docs/output/files/Utilities.php.txt. Cross origin requests are only supported for HTTP.

So I started a small http-server and tried the source code links again. It works. Excellent! Sorry for the wrong report above. I hope my tip helps others too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrfnl picture jrfnl  Â·  5Comments

juliushaertl picture juliushaertl  Â·  5Comments

giovkanata picture giovkanata  Â·  5Comments

joshmbg picture joshmbg  Â·  5Comments

mvriel picture mvriel  Â·  5Comments