realpath() and destructors

php.internals

Stephan Schmidt

21 years ago
Hi, I found another strange behaviour in PHP5, it occurred only on my Windows machine using the Apache SAPI (tried it on Debian with PHP-CGI and it worked fine). The following code: <?php class Foo { public function __construct() { echo realpath('./') . "\n"; } public function __destruct() { echo realpath('./') . "\n"; } } $foo = new Foo(); ?> returns: c:\www\projects\pat\patportal\examples c:\programme\apache group\Apache Best regards, Stephan
-- http://www.php-tools.net http://www.schst.net http://pear.php.net

Johannes Schlueter

21 years ago
Hi Stephan, this is by design and was discussed before, please check the archives. And should happen on Linux with mod_php, too. johannes Stephan Schmidt wrote:
> Hi, > > I found another strange behaviour in PHP5, it occurred only on my > Windows machine using the Apache SAPI (tried it on Debian with PHP-CGI > and it worked fine). > > The following code: > > <?php > class Foo > { > public function __construct() > { > echo realpath('./') . "\n"; > } > > public function __destruct() > { > echo realpath('./') . "\n"; > } > } > > $foo = new Foo(); > ?> > > returns: > > c:\www\projects\pat\patportal\examples > c:\programme\apache group\Apache > > Best regards, > > Stephan
-- Johannes Schlüter Mayflower GmbH / ThinkPHP http://thinkphp.de http://blog.thinkphp.de

Daniel Convissor

21 years ago
On Tue, Feb 22, 2005 at 09:08:31PM +0100, Stephan Schmidt wrote:
> > c:\www\projects\pat\patportal\examples > c:\programme\apache group\Apache
I found similar weirdness. When using the CGI, on my Windows 2000 machine when doing realpath('.') I get the path to the document root, as expected. But when doing the same thing on my Windows XP Pro machine, it returns the path to my PHP installation. --Dan
-- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409