Overriding Symfony FileSystem's tempnam() method

159 Views Asked by At

I'm trying to run Symfony 2.8 on Google App Engine. Symfony 2.8 added their own version of tempnam(), see here, which won't work properly on App Engine because it doesn't recognize the gs:// scheme.

I've written a working patch here:

 if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
      $tmpFile = tempnam($hierarchy, $prefix);

      // If tempnam failed or no scheme return the filename otherwise prepend the scheme
      if (false !== $tmpFile) {
          if (null !== $scheme && 'gs' !== $scheme) {
              return $scheme.'://'.$tmpFile;

          }

          return $tmpFile;
      }

      throw new IOException('A temporary file could not be created.');
  }

but I don't know how to enable this without writing code in core classes.

Any help?

0

There are 0 best solutions below