sfox            Sun Jun 22 16:35:26 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   phar_object.c 
  Log:
  - Revert the two blocks of code that implement the phar_build optimization, 
causes segfaults under *nix
  - Leave the new structure in place to make re-implementation trivial
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266.2.29&r2=1.266.2.30&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.266.2.29 
php-src/ext/phar/phar_object.c:1.266.2.30
--- php-src/ext/phar/phar_object.c:1.266.2.29   Sun Jun 22 13:10:03 2008
+++ php-src/ext/phar/phar_object.c      Sun Jun 22 16:35:26 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_object.c,v 1.266.2.29 2008/06/22 13:10:03 sfox Exp $ */
+/* $Id: phar_object.c,v 1.266.2.30 2008/06/22 16:35:26 sfox Exp $ */
 
 #include "phar_internal.h"
 #include "func_interceptors.h"
@@ -1614,13 +1614,7 @@
                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 @@
 
        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;
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to