Skip to content

Paths for --filename and <file> are not resolved correctly #2046

@fi5er

Description

@fi5er

The --filename command line argument cannot be given absolute paths or relative paths that start at the current directory or a parent directory. The same goes for the -f alias and for <file> in a config file.

Given the following directory structure:

├── CURRENT_DIR
│   ├── subdir
│   │   └── Test.php
│   └── Test.php
└── other
    └── Test.php

Actual Behavior

Running phpdoc from CURRENT_DIR may or may not find the file "Test.php" using the command line phpdoc parse --filename path --force -vvv. I get the following results for different paths:

  • Test.php - found
  • ./Test.php - not found
  • ../CURRENT_DIR/Test.php - not found
  • subdir/Test.php - found
  • subdir/../Test.php - not found
  • ./subdir/Test.php - not found
  • ../other/Test.php - not found
  • /abs/path/to/other/Test.php - not found

The debug output is

[2018-12-23 17:19:32] app.INFO: One of the project's settings have changed, forcing a complete rebuild [] []
[2018-12-23 17:19:32] app.INFO: Elapsed time to parse all files: 0s [] []
[2018-12-23 17:19:32] app.INFO: Peak memory usage: 10M [] []

Expected Behavior

A "Test.php" file should be found in all of these paths.

Steps to Reproduce the Problem

  • $ mkdir -p dirtest/CURRENT_DIR/subdir dirtest/other
  • $ cd dirtest/CURRENT_DIR
  • $ touch Test.php
  • $ cp Test.php subdir
  • $ cp Test.php ../other
  • $ phpdoc parse --filename ../other/Test.php --force -vvv

Your environment

  • Version used: v3.0.x-dev@ee92b8f
  • Install method: cloned "develop" branch
  • php version: 7.2.10
  • Operating system and version: Kubuntu 18.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions