matyssik
Forum Replies Created
-
Forum: Plugins
In reply to: [W3 Total Cache] AWS CDN (S3 -> Cloudfront)Hi @vmarko
Thanks for a quick reply. This is awesome, I hope that it will be merged very soon. I’ll provide comments in the PR or issue if I have any. Thanks!
Thanks Jordy, that works too. Would be great if it is included in the next release, will patch it manually for now.
Since the solution is provided, resolving.
Resolving the issue, since the problem is not there any longer after replacement of tmp file handling.
As I suspected, stream metadata returned by
stream_get_meta_data()
are missing a lot of info [1], why not usetimpanum()
instead of opening and closing actual temp file. Here is how I fixed the problem:function b64_to_file( $str ) { $file = tempnam( sys_get_temp_dir(), "wplr" ); $ifp = fopen( $file, "wb" ); fwrite( $ifp, base64_decode( $str ) ); fclose( $ifp ); return $file; }
[1] `Array
(
[wrapper_type] => plainfile
[stream_type] => STDIO
[mode] =>
[unread_bytes] => 0
[seekable] => 1
[uri] =>
[timed_out] =>
[blocked] => 1
[eof] =>
[wrapper_data] =>
)`Thanks, understandable.
I am using the latest version of both WP and LR plugins.
I suspect thatstream_get_meta_data
[1] has a slightly different implementation from PHP and possibly ‘uri’ in the returned array is not filled fortmpfile()
, of course I could be completely wrong. Let me try to dig in a bit deeper and see if I can fix it to make it work for both HHVM and PHP. Would welcome any ideas.[1] https://docs.hhvm.com/manual/en/function.stream-get-meta-data.php