Issues

ZF-12250: file_exists() always returns true when using stream wrapper Zend_Service_Amazon_S3_Stream

Issue Type: Bug Created: 2012-05-25T16:09:52.000+0000 Last Updated: 2012-10-03T22:07:14.000+0000 Status: Open Fix version(s): Reporter: Shane Iseminger (shaneiseminger) Assignee: Enrico Zimuel (zimuel) Tags: - Zend_Service_Amazon

  • amazon

Related issues: Attachments:

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:

<pre class="literal">
@@ -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;
     }

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts