if (for_write) {
/* open a new temp file for writing */
entry->fp = php_stream_fopen_tmpfile();
+ if (!entry->fp) {
+ if (error) {
+ spprintf(error, 0, "phar error: unable to create temprary file");
+ }
+ return FAILURE;
+ }
(*ret)->fp = entry->fp;
entry->is_modified = 1;
phar->is_modified = 1;
memset(&etemp, 0, sizeof(phar_entry_info));
etemp.filename_len = path_len;
etemp.fp = php_stream_fopen_tmpfile();
+ if (!etemp.fp) {
+ if (error) {
+ spprintf(error, 0, "phar error: unable to create temorary file");
+ }
+ return NULL;
+ }
etemp.fp_refcount = 1;
etemp.is_modified = 1;
etemp.filename = estrndup(path, path_len);
closeoldfile = oldfile != NULL;
}
newfile = php_stream_fopen_tmpfile();
+ if (!newfile) {
+ if (error) {
+ spprintf(error, 0, "unable to create temporary file");
+ }
+ if (closeoldfile) {
+ php_stream_close(oldfile);
+ }
+ return EOF;
+ }
if (user_stub) {
if (len < 0) {
in read count */
entry->compressed_filesize = 0;
entry->cfp = php_stream_fopen_tmpfile();
+ if (!entry->cfp) {
+ if (error) {
+ spprintf(error, 0, "unable to create temporary file");
+ }
+ if (closeoldfile) {
+ php_stream_close(oldfile);
+ }
+ php_stream_close(newfile);
+ efree(buf);
+ return EOF;
+ }
do {
read = php_stream_read(file, buf, 8192);
if (read) {