Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 160456 - Implement a path mapper!
Summary: Implement a path mapper!
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: All Windows XP
: P2 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Shalom Gibly CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 165206
  Show dependency tree
 
Reported: 2006-10-11 07:29 EDT by Dominic Clifton CLA
Modified: 2020-05-14 11:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Clifton CLA 2006-10-11 07:29:36 EDT
Additionally there is no feature to enable mapped paths like there is with php dbg, phpeclispe.

I have a path setup as follows:

C:\Projects\MyProject\
  + htdocs\
  + lib\
    + CMyClass.php

http://mybox/ has a DOCUMENT_ROOT set to C:\Projects\MyProject\htdocs\

Thus, when I pick the index.php in the debug configuration screen it creates a url as follows:

http://mybox/htdocs/index.php

which is of course totally wrong.  The problem is that the current configuration dialog cannot cope with projects that either a) have a document root that is somewhere other than the root, b) has a server that uses rewrite rules and c) has files that live outside of the project. (correct me if I'm wrong)

All files and urls needs to be passed though a mapper, which is how php dbg  and phpeclipse works and it does it right 100% of the time, even for compliated project layouts.

When the webserver opens a file it knows where the files are located, as the debug module runs in the webserver the debug module can know about the urls and their absolute paths.  

the web server's debugger module should then send full path to the debug client in php ide, then php ide should run this though a path mapper to determine the correct local paths.

using the scenario about i would have a path map as follows:

remote path => C:\Projects\MyProject\htdocs
local path => C:\Projects\MyProject\htdocs

notice something?  they're the same paths.  so why a path mapper you're asking.

If I moved my project from C:\Projects\MyProject to N:\Projects\MyProject and N: was a network drive on a remote webserver that had a url of http://dominic.remotebox which had a DOCUMENT_ROOT of D:\Share\Dominic\Projects\MyProject\htdocs I would create a mapping as follows:

remote path => D:\Share\Dominic\Projects\MyProject\htdocs
local path => N:\Projects\MyProject\htdocs

For complicated projects that have symlinked folders you normally need more than one mapping.  e.g. if you have 2 or more clients using a shared set of library code that lived on D:\Web\Common\Lib which was symlinked to by D:\Share\Dominic\Projects\MyProject\lib you would need another mapping as follows:

remote path => D:\Web\Common\Lib
local path => N:\Projects\MyProject\lib

Additionally rewrite rules are catered for here because the webserver's debugger module always knows the absolute path of the file being using as it takes place AFTER the rewrite rule has applied.

path mapping also opens the door for cross-platform remote debugging, as the path mapper can translate unix style / relative paths into windows style drive letter relative paths too.

a path mapper only looks at the first part of the file being opened

so if (using my second example) i had file called

D:\Share\Dominic\Projects\MyProject\htdocs\anotherfolder\anotherentrypoint.php

it would only look at the paths in the path mapper's list before replacing with the local path, to the file would be resolved to:

N:\Projects\MyProject\htdocs\anotherfolder\anotherentrypoint.php

Further more, in the debug UI the url should probably NOT be automatically built as it doesn't make sense most of the time,.  You could have a "GUESS" button to the right of the URL text box though.  

You should be able to specify the webserver's DOCUMENT ROOT (and optionally a "context path").  The path mapper would use the document root to determine where to open files from, it should also be the REMOTE WEBSERVER'S document root.  If the project's path and the document root are the same then no path mappings are required.

Please implement ASAP as this is a very important when doing anything other than basic php scripts/sites.  remember, it's the larger sites that actually NEED a debugger so those are the ones you need to cater for!
Comment 1 Shalom Gibly CLA 2007-08-27 10:09:09 EDT
We applied a fix that should handle situations where the apache server has an 
alias directive. 
This directive caused the debugger to skip breakpoints and the fix addressed 
this issue by computing the currect file location and setting the breakpoints 
on the right places. 
Please update the bug with the relevand issues that still need some 
modifications. 
(this fix will be avalable in the next integration build)
Comment 2 Gadi Goldbarg CLA 2007-09-02 15:59:10 EDT
the implemetation mentioned by shalom works fine for aliases+vhost.
YOu should select the file in the workspace, but in the debug  launch 
configuration dialog - you should point to the URL. 
Uncheck the generate url and enter your URL. It should function as expected 
from this point and on
Comment 3 Gadi Goldbarg CLA 2007-09-02 16:17:39 EDT
fixed