php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50386 Strange realpath() behavior in shutdown functions
Submitted: 2009-12-04 14:16 UTC Modified: 2009-12-06 09:49 UTC
From: dzlatanov at softproekt dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.2.11 OS: Linux / Windows
Private report: No CVE-ID: None
 [2009-12-04 14:16 UTC] dzlatanov at softproekt dot com
Description:
------------
I noticed that realpath() function does not return the same result when called during the regular script execution and in the shutdown process.

This behavior only appears when PHP is running as Apache module, but not in CGI/FastCGI mode.

Tested with PHP 5.2.6, 5.3.0, 4.4.8.

Reproduce code:
---------------
<?php

function MyShutdownFunc() {
    echo realpath("./") . "<br />";
}

MyShutdownFunc();

register_shutdown_function("MyShutdownFunc");

?>


Expected result:
----------------
/www/mysite.com/staging/root
/www/mysite.com/staging/root


Actual result:
--------------
/www/mysite.com/staging/root
/

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-05 17:26 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2009-12-06 09:49 UTC] dzlatanov at softproekt dot com
Thank you for this clarification. I had checked the manual before posting this bug. I was not able to find anything related to different realpath() behavior in shutdown functions when PHP is configured to run as CGI or as Apache module however.

I would still consider this strange, as the same code might not perform in the same way when executed on different machines, provided that there are no configuration options to avoid it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 07:01:30 2024 UTC