Closed (fixed)
Project:
AmazonS3
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Reporter:
Created:
4 May 2012 at 12:58 UTC
Updated:
28 Mar 2013 at 14:13 UTC
Jump to comment: Most recent file
PHP contains a bug where for certain user-space stream wrappers the constructor is not called: https://bugs.php.net/bug.php?id=40459 .
It will probably take a while before this bug is fixed and a new PHP version is released. My suggestion is to add code to the Amazon S3 stream wrapper to invoke the constructor if it hasn't been called.
The reason I hit on this bug was that file_exists('s3://file') calls AmazonS3StreamWrapper::url_open(). Because the constructor isn't called, $this->cache is false, so these file_exists() calls always call S3, even when the file has been cached.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | amazons3-constructorbug-1561176-10.patch | 3.63 KB | Jorrit |
| #1 | amazons3-constructorbug-1561176-1.patch | 3.66 KB | Jorrit |
Comments
Comment #1
Jorrit commentedPlease see attached patch.
Comment #2
justafishI've submitted a patch for this to PHP https://github.com/php/php-src/pull/93
Comment #3
Jorrit commentedI wouldn't bet on getting it committed quickly: http://markmail.org/message/zhj7h34x2xzk6an5
Comment #4
klakegg commentedLooks like a fix is in, but it doesn't help today. Could we have it work correct now, and have the perfect code later?
https://github.com/php/php-src/pull/153
Comment #5
Jorrit commentedBy the way: my patch works regardless of the fix in PHP.
Comment #6
klakegg commentedThis bug is a showstopper.
Comment #7
justafishPatch needs rerolling
Comment #8
Jorrit commentedHere you go.
Comment #9
justafish@Jorrit please attach a patch
Comment #10
Jorrit commentedWeird, I was sure it was there.
Comment #11
justafishThanks, committed!
Comment #13
Jorrit commentedBy the way: this patch is not necessary anymore from PHP 5.4.7 and up, see http://www.php.net/ChangeLog-5.php#5.4.7 .