]> granicus.if.org Git - php/commitdiff
- Revert the two blocks of code that implement the phar_build optimization, causes...
authorSteph Fox <sfox@php.net>
Sun, 22 Jun 2008 16:35:26 +0000 (16:35 +0000)
committerSteph Fox <sfox@php.net>
Sun, 22 Jun 2008 16:35:26 +0000 (16:35 +0000)
- Leave the new structure in place to make re-implementation trivial

ext/phar/phar_object.c

index 25ff33702acf1410b3273b0961cd88030f82db16..0078ab69593ec77221b476deb39e7b7015dae5a8 100755 (executable)
@@ -1614,13 +1614,7 @@ after_open_fp:
                if (error) {
                        efree(error);
                }
-               /* convert to PHAR_UFP */
-               php_stream_close(data->internal_file->fp);
-               data->internal_file->fp_type = PHAR_UFP;
-               data->internal_file->offset_abs = data->internal_file->offset = php_stream_tell(p_obj->fp);
-               contents_len = php_stream_copy_to_stream(fp, p_obj->fp, PHP_STREAM_COPY_ALL);
-               data->internal_file->uncompressed_filesize = data->internal_file->compressed_filesize =
-                       php_stream_tell(p_obj->fp) - data->internal_file->offset;
+               contents_len = php_stream_copy_to_stream(fp, data->fp, PHP_STREAM_COPY_ALL);
        }
        if (close_fp) {
                php_stream_close(fp);
@@ -1637,6 +1631,16 @@ after_open_fp:
 
        data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize = contents_len;
        phar_entry_delref(data TSRMLS_CC);
+
+       if (++p_obj->count && p_obj->count % 900) {
+               /* every 900 files, flush so we remove open temp file handles, fixes Bug #45218 */
+               phar_flush(p_obj->p->arc.archive, 0, 0, 0, &error TSRMLS_CC);
+               if (error) {
+                       zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);
+                       efree(error);
+                       return ZEND_HASH_APPLY_STOP;
+               }
+       }
        return ZEND_HASH_APPLY_KEEP;
 }
 /* }}} */