For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > July 2007 > #34206 [Com]: cwd set to server root (?) in __destruct









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #34206 [Com]: cwd set to server root (?) in __destruct
hans dot duedal at gmail dot com

2007-07-30, 8:00 am

ID: 34206
Comment by: hans dot duedal at gmail dot com
Reported By: maniac_warlord at web dot de
Status: Open
Bug Type: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
New Comment:

I believe this is what's causing bug:29167, as well.


Previous Comments:
------------------------------------------------------------------------

[2005-08-26 11:09:46] sniper@php.net

This really should be documented. Apache(1&2) does the weird
cwd change for some reason.


------------------------------------------------------------------------

[2005-08-21 19:11:26] maniac_warlord at web dot de

Description:
------------
cwd is set to server root (i guess) instead of called php file's
directory in __destruct()

it probably isn't server root (see results), because that would be /www
on linux - on windows it is

Reproduce code:
---------------
<?php
class Foo
{
public function bar()
{
echo getcwd() . "\n";
}

public function __destruct()
{
$this->bar();
}
}
$f = new Foo();
$f->bar();
?>

Expected result:
----------------
Windows XP:
F:\htdocs
F:\htdocs

My webhoster's linux:
/www/htdocs/[some number]
/www/htdocs/[some number]

(or whatever directory the file is in)

Actual result:
--------------
Windows XP:
F:\htdocs
D:\Apache\Apache 2

My webhoster's linux:
/www/htdocs/[some number]
/


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=34206&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com