|  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
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:

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




Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


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

 [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: Fri Jun 21 02:01:28 2024 UTC