ZF-12250: file_exists() always returns true when using stream wrapper Zend_Service_Amazon_S3_Stream
Description
My understanding is that StreamWrapperClass::url_stat() should return false just like stat() when a file doesn't exist.
When given a nonexistent file path, Zend_Service_Amazon_S3_Stream::url_stat() returns an array with all values set to 0 except 'mode', causing the wrapped file_exists() to return true.
Comments
Posted by Luís Filipe Faceira (luisfaceira) on 2012-10-03T22:07:14.000+0000
You can't imagine how much time it took for me to trace a big issue up to this issue!
I've made a simple fix, but I'm unsure what the policy is for contributing, and since it's such a small change, I'll post it here for the assignee to validate and apply, if he so wants:
@@ -460,9 +460,13 @@ class Zend_Service_Amazon_S3_Stream $stat['size'] = $info['size']; $stat['atime'] = time(); $stat['mtime'] = $info['mtime']; + + return $stat; + } + else{ + return false; } - return $stat; }