|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37779 [PATCH] _php_stream_fopen_with_path searches for files in /
Submitted: 2006-06-11 10:35 UTC Modified: 2006-09-12 15:49 UTC
From: jr at terragate dot net Assigned:
Status: Closed Package: Streams related
PHP Version: 5.1.5CVS OS: Mac OS X (10.4)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jr at terragate dot net
New email:
PHP Version: OS:


 [2006-06-11 10:35 UTC] jr at terragate dot net
_php_stream_fopen_with_path will try to open files relative 
to / if the given file does not exist in the current working 


Index: main/streams/plain_wrapper.c
RCS file: /repository/php-src/main/streams/plain_wrapper.c,v
retrieving revision
diff -u -u -r1.52.2.6 plain_wrapper.c
--- main/streams/plain_wrapper.c        17 Jan 2006 02:32:09 
+++ main/streams/plain_wrapper.c        11 Jun 2006 10:01:11 
@@ -1316,6 +1316,10 @@
                        *end = '\0';
+               if (*ptr == '\0') {
+                       ptr = end;
+                       continue;
+               }
                snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, 
                if (((options & STREAM_DISABLE_OPEN_BASEDIR) 
== 0) && php_check_
open_basedir_ex(trypath, 0 TSRMLS_CC)) {

Reproduce code:

include 'etc/hosts';


Expected result:
Warning: include(etc/hosts): failed to open stream: No such 
file or directory in ...

Expected existence checks (include_path=.:):


Actual result:
Output of /etc/hosts

Actual existence checks (include_path=.:):



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-08 20:55 UTC]
Sara, could you plz check this out?
 [2006-09-12 15:49 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC