php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58914 Unable to handle local stream wrappers
Submitted: 2009-10-22 11:01 UTC Modified: 2009-11-25 15:01 UTC
From: mkoppanen@php.net Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.11 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mkoppanen@php.net
New email:
PHP Version: OS:

 

 [2009-10-22 11:01 UTC] mkoppanen@php.net
Description:
------------
Opening a bug on Gopal's request. The issue is that APC is not able to to resolve the full path of the file if the filename is a stream wrapper.

Let me know if you need additional information.


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

class MyTestStream {

	public function stream_open($path, $mode, $options, &$opened_path) {
		$opened_path = str_replace('my.test.stream://', '', $path);
		return true;
	}

	public function stream_read($count) { return ''; }

	public function stream_eof() { return true; }

	public function url_stat() { return stat('/tmp/test.php'); }
}

stream_wrapper_register('my.test.stream', 'MyTestStream');
include 'my.test.stream:///tmp/test.php';
?>

Expected result:
----------------
No error 

Actual result:
--------------
If apc.stat=0 and -D__DEBUG_APC___ are used the following output is generated:

1. h->opened_path=[/mnt/hgfs/workspace/stream.php]  h->filename=[stream.php]
[Thu Oct 22 14:56:16 2009] [apc-warning] apc failed to locate stream.php - bailing
1. h->opened_path=[null]  h->filename=[my.test.stream:///tmp/test.php]
[Thu Oct 22 14:56:16 2009] [apc-warning] realpath failed to canonicalize my.test.stream:///tmp/test.php - bailing in /mnt/hgfs/workspace/stream.php on line 20.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-25 09:45 UTC] mkoppanen@php.net
Hello,

I came up with the following patch:

http://valokuva.org/~mikko/patches/pecl_16896_apc_stream_wrappers.patch.txt
 [2009-11-25 10:40 UTC] mkoppanen@php.net
Looks like apc.canonicalize=1 allows falling back to stat mode which works for stream wrappers.
 [2009-11-25 15:01 UTC] mkoppanen@php.net
Closing this one as the functionality is available.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC