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

Conflicting parser file extensions #1679

Open
PhrozenByte opened this issue Nov 29, 2015 · 3 comments
Open

Conflicting parser file extensions #1679

PhrozenByte opened this issue Nov 29, 2015 · 3 comments

Comments

@PhrozenByte
Copy link
Contributor

Pico has a default index.php for composer users and a separate index.php.dist used for our pre-bundled releases. It's intended that both files are included in the API docs. The <parser><extensions> section in our phpdoc.xml therefore looks like the following:

<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
    <parser>
        <extensions>
            <extension>php</extension>
            <extension>php.dist</extension>
        </extensions>
    </parser>
</phpdoc>

When running phpDocumentor, the resulting files/ folder looks extremely weird:

  • files/index.html is the output file for index.php
  • files/index.php.txt is a copy of index.php
  • files/index.php.html is the output file for index.php.dist
  • files/index.php.dist.txt is a copy of index.php

This is definitely not expected by a user, but at least doesn't cause bigger problems. phpDocumentor seems to always remove the last file extension from the filename and adds .html for output files, and just adds .txt for the source code.

Now consider multiple multi-part file extensions:

<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
    <parser>
        <extensions>
            <extension>php</extension>
            <extension>php.src</extension>
            <extension>php.dist</extension>
        </extensions>
    </parser>
</phpdoc>

This will break phpDocumentor! It will indeed provide files/index.php.src.txt and files/index.php.dist.txt, but both output files will be written to files/index.php.html - depending on which of the files was parsed later, the prior gets overwritten silently.

phpDocumentor shouldn't modify the file extension for output files at all, or, to have a backwards-compatible solution, at least remember and check already created output files to avoid conflicts.

@mvriel
Copy link
Member

mvriel commented Dec 2, 2015

This is an interesting use case which wasn't considered during the implementation for this item. I have no solution readily available but we should obviously fix this issue

@mvriel mvriel added this to the 2.8.2 milestone Dec 2, 2015
@jaapio jaapio closed this as completed May 22, 2016
@jaapio jaapio removed the ready label May 22, 2016
@PhrozenByte
Copy link
Contributor Author

@jaapio: Why has this been closed? This bug is still reproducible with phpDocumentor 2.9.0:

$ vendor/bin/phpdoc -f index.php -f index.php.dist -f index.php.src
…
Parsing /var/www/html/projects/private/pico/Workspace/index.php
  No summary was found for this file
Parsing /var/www/html/projects/private/pico/Workspace/index.php.dist
  No summary was found for this file
Parsing /var/www/html/projects/private/pico/Workspace/index.php.src
  No summary was found for this file
…

$ ls -1 output/files/
index.html
index.php.dist.txt
index.php.html
index.php.src.txt
index.php.txt

$ grep '<h1><small></small>' output/files/index.php.html 
                    <h1><small></small>index.php.src</h1>

@jaapio
Copy link
Member

jaapio commented May 23, 2016

Sorry, closed this accidentally.

@jaapio jaapio reopened this May 23, 2016
@jaapio jaapio modified the milestones: 2.9.1, 2.9.0 May 23, 2016
@mvriel mvriel modified the milestones: 2.10.0, 2.9.1 May 19, 2017
@mvriel mvriel added this to Needs triage in Issue Triage via automation Nov 22, 2019
@mvriel mvriel removed this from the 2.10.0 milestone Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs triage
Issue Triage
  
Needs triage
Development

No branches or pull requests

3 participants