- if (IS_ABSOLUTE_PATH(filename, strlen(filename)) && apc_stat(filename, &fileinfo->st_buf) == 0) {
- strncpy(fileinfo->fullpath, filename, MAXPATHLEN);
+
+ wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC);
+
+ if(!wrapper || !wrapper->wops || !wrapper->wops->url_stat) {
+ return -1;
+ }
+
+#ifdef ZEND_ENGINE_2
+ if(wrapper != &php_plain_files_wrapper) {
+ if(APC_URL_STAT(wrapper, path_for_open, &fileinfo->st_buf) == 0) {
+ strncpy(fileinfo->fullpath, path_for_open, MAXPATHLEN);
+ return 0;
+ }
+ return -1; /* cannot stat */
+ }
+#endif
+
+ if (IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open)) &&
+ APC_URL_STAT(wrapper, path_for_open, &fileinfo->st_buf) == 0) {
+ strncpy(fileinfo->fullpath, path_for_open, MAXPATHLEN);