1

I have a php app deployed on appengine it depends on fuel/mail, which itself depends on guzzle/guzzle. When, I try to attach and send file with an e-mail, it fails because of is_readable returning false on file that actually exists and is readable. Here is how to replicate things:

//done in my app following recomendation on appengine documentation page
$dir = sys_get_temp_dir();
$tmp = tempnam($dir, 'foo.txt');
echo $tmp;        // => "vfs://root/temp/foo.txt581fd3e4e1ca86.63583518"
file_put_contents($tmp, 'hello');

//just to check
echo 'file content : '.file_get_contents($tmp); // => "file content : hello"

//done in guzzle/guzzle
echo('file is readable : '.(is_readable($tmp)?'true':'false')); // => "file is readable : false"

As is_readable returns false, the whole thing fails. Note, that it is working on an apache/php deployment.

So, am I doing something wrong? Is app engine environment behaving not as it should? Is guzzle not using is_readable properly? If the issue does not come from me, any workaround while waiting for a fix?

  • I dont use Google App Engine and I dont really know how it works - but have you made sure that the virtual filesystem isn't the source of the problem? Have you tried using the OS' temp directory (`/tmp`)? – Charlotte Dunois Nov 07 '16 at 05:44
  • As specified in the [documentation](https://cloud.google.com/appengine/docs/php/runtime#tempnam_and_sys_get_temp_dir_support), appengine does not allow writing into the local file system. So, I believe it is an issue with the implementation of is_redable on app engine. One temporary workaround, that I found is to write the file to [google cloud storage](https://cloud.google.com/appengine/docs/php/googlestorage/). – Nicolas Lagier Nov 09 '16 at 00:29
  • GAE is a strange PHP environment, there is an open issue about GAE and Guzzle, it has quite a few details about different issues: https://github.com/guzzle/guzzle/issues/1640 – mark.sagikazar Nov 09 '16 at 11:16
  • It is indeed a strange environment. According to google, things are [working as intendeed](https://code.google.com/p/googleappengine/issues/detail?id=13394). Doing it with cloud storage actually also fails a bit later within guzzle. So, I will probably add a new issue on guzzle side and try to move away from GAE at the same time. – Nicolas Lagier Nov 23 '16 at 02:27

0 Answers0