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.
Fast import should start file paths with dirname(__FILE__) or at least it should be available as an option. When current file is included/required from other file, the "../..." syntax doesn't work.
reassigning to default owner
batch reassigning
This is technically a bug. If just the file name is used, then it must be included on the include_path. This doesn't work if your included file is in a subdirectory of your project which isn't actually part of the include_path. So, if relative to some file up the stack, then ../../somefile.php works fine. If in the same directory, then ./somefile.php should be used. Also, it would be handy if one has patterns they require to be able to pick dirname(__FILE__)/somefile.php as an option. The issues with . and .. and full paths and relative paths with no periods is detailed well at: http://www.php.net/manual/en/function.include.php
I am going ahead and changing the version to 7.2. This needs to remain current on the list of issues.
Updating the summary to reflect the "./filename.php" portion of the problem. This isn't simply related to dirname(__FILE__) as the issue is that NetBeans doesn't correctly follow the documentation of include per the link I have already provided.
It's P4 defect for me...fast import is not recommended action since we have autoloading in PHP 5. But when I'll have a time, I'll look at it. Thanks for evaluation.
Your welcome on the evaluation. Is there something which tells the user that fast import perhaps isn't the desired action? To me if it is a feature of the IDE it should not create incorrect code which is the case if one can not adjust include_path which is the case, and in many cases would not be wanted. Probably that would be nearly all cases for sub-directories of files to be included in the users project.I will investigate further from a usability etc point of view. Thank you.
(In reply to comment #7) > To me if it is a feature of the > IDE it should not create incorrect code Definitely yes ;) That's why it's a valid defect. But with a low priority for me now...I have more crucial bugs to fix now. But as I wrote, I'll try to look at it...I put it into my todo list. Thanks.
Thanks much. I noticed something else now. With the latest updates on my install on Linux I'm seeing that fast import does nothing. However, I can type include("|"); and at the cursor CTRL+SPACE and the files to import show up, and if I have the structure: php-test-project -index.php -inc --1.php --2.php and I am in 2.php, then I see 1.php. If I select it, then I get: include("1.php"); which I would really want include("./1.php");
...and...what? I don' t know what's the issue. If you want a a path prefix, just write it there. Or you want some option with a checkbox, which tells NetBeans that your included completed files should use "./" path prefix? Then file a new enhancement.
To first understand the problem, you need to read the link I have provided in the issue. Not having the ./ in front of the file name makes the import be treated significantly different. This is having inc on the include_path versus not. Since it isn't, then it should most definitely be prefixed with a ./ since it is in the same folder. The IDE is creating incorrect code in the case I'm providing as in no case would one want the folder inc in their project on the global include_path variable. The point of using an IDE is to make work better and faster not to just have a text editor. There lies the issue.
Perhaps the fix is to provide two options for what to place into the file when one clicks on the auto complete item. Could be 1.php and ./1.php. That would give a person an option perhaps. One could view it as simply an enhancement, but that doesn't do justice to the documentation of PHP compared to the editing feature set. Too, in the context of which one is editing, the IDE knows the file is relative. If the intent is to treat it as relative, then it is an outright bug as that is not what will happen. If the intent is to simply show the names, albeit showing them relative, and then to just get the name there as fast as possibly, then that is something else entirely.
Ok, I'll try to look at it as well.
Created attachment 127060 [details] Proposed patch This patch should fix it. I'll look at it once again probably on monday.
Fixed in web-main #08417dc7d9be
Integrated into 'main-golden', will be available in build *201211060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/08417dc7d9be User: Ondrej Brejla <obrejla@netbeans.org> Log: #157421 - Fast import should use "dirname(__FILE__)" or "./filename.php"-syntax