This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 259073 - Support relative path completion despite __DIR__ or dirname(__FILE__)
Summary: Support relative path completion despite __DIR__ or dirname(__FILE__)
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2016-04-30 10:39 UTC by nordlichtxs
Modified: 2016-04-30 10:41 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description nordlichtxs 2016-04-30 10:39:21 UTC
Path completion works great with this:
require_once './subdir/script.php';

But PHP has funky relative paths as they are evaluated relative to the initial script, not the current one. URL rewriting/mapping is another issue with relative paths. These problems can be solved in a concise manner by using __DIR__ to get the path of the current script and appending the relative part.
require_once __DIR__.'./subdir/script.php';

Now Netbeans path completion does not work at all if there is a constant before the string.

My feature request / idea would be to specifically ignore "__DIR__." and "dirname(__FILE__)." (without quotes) before the first string of require, require_once etc. 

I imagine this to be an easy change which would make path completion usable for many, many more projects.

The same could be applied to other php functions that deal with files.

The evaluation of constants and (resolvable) variables would be awesome as well. This would enable path completion relative to any directory if you have a constant/variable for it (e.g. IMAGES_DIR, UPLOAD_DIR etc). But I imagine this would be a somewhat larger effort.

What do you say? ^^