title: ZIP file not being created, but no error gets triggered
body: <p>I'm using ZipArchive:  </p>
  
  <pre><code>function zip_dir($source, $target){
  
      $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
  
      $zip = new \ZipArchive();
      if($zip-&gt;open($target, \ZipArchive::CREATE) !== true)
        exit('cannot create zip');
  
      foreach($iterator as $file){
        $zip-&gt;addFile($file);
        print $file . '&lt;br&gt;';
      }
  
  
      $zip-&gt;close();
      return $target;
  }
  
  
  zip_dir(__DIR__ . '/test/', __DIR__ . '/testarchive.zip');
  </code></pre>
  
  <p>I can see the list of files, but in the end I cannot find the zip file that's supposed to be created. And I get no errors / exceptions from ZipArchive...</p>
  
  <p>edit:</p>
  
  <p>I've added <code>print $zip-&gt;getStatusString();</code> after <code>$zip-&gt;close();</code></p>
  
  <p>and it prints :Can't open file: Permission denied".
  What does that mean? I know for sure every directory is writable, bc I can create new files with PHP inside them...</p>
  
  <p>edit 2:</p>
  
  <pre><code>if(is_writable(dirname($target)))
    print 'target dir is writable...';
  </code></pre>
  
  <p>it prints that, so the dir is writable. Feels like I'm in the twilight zone...</p>