Opened 21 years ago

Closed 20 years ago

#43 closed defect (fixed)

Function ms_newMapObj changes PHP's current directory

Reported by: tokr@… Owned by: dmorissette
Priority: high Milestone:
Component: MapScript-PHP Version: 3.5
Severity: minor Keywords:


Function ms_newMapObj changes PHP's current directory without any notice.
There is a way around:

$cwd = getcwd();
$mapObj = ms_newMapObj("???.map");

As I remember there is no PHP function except chdir with this behaviour. The 
reason for is probably using relative paths in the MAP file but I think there 
are only two possibilities:
  1. Write it to the documentation.
  2. Correct it.

Change History (3)

comment:1 by dmorissette, 21 years ago

Cc: steve.lime@… added

comment:2 by dmorissette, 21 years ago

ms_newMapObj() is not the only function that affects the CWD in PHP MapScript.  
DrawMap(), and most other functions that access files in the backend will affect 
it as well.

I'll try to add a note in the docs about this, but this has to be fixed anyway. 
 The fix will be to remove all chdir() calls in MapServer, or at least use cover 
functions that can be mapped to PHP4's thread-safe virtual_cwd API when 
compiling PHP MapScript.

comment:3 by dmorissette, 20 years ago

Resolution: fixed
Status: newclosed
Marking as fixed.  All chdir() calls have been removed in MapServer 3.7
Note: See TracTickets for help on using tickets.