@@ -2496,16 +2496,16 @@ zend_string *phar_create_default_stub(const char *index_php, const char *web_ind
24962496}
24972497/* }}} */
24982498
2499- void phar_flush (phar_archive_data * phar , char * * error ) {
2500- phar_flush_ex (phar , NULL , false, error );
2499+ int phar_flush (phar_archive_data * phar , char * * error ) {
2500+ return phar_flush_ex (phar , NULL , false, error );
25012501}
25022502
25032503/**
25042504 * Save phar contents to disk
25052505 *
25062506 * if user_stub is NULL the default or existing stub should be used
25072507 */
2508- void phar_flush_ex (phar_archive_data * phar , zend_string * user_stub , bool is_default_stub , char * * error ) /* {{{ */
2508+ int phar_flush_ex (phar_archive_data * phar , zend_string * user_stub , bool is_default_stub , char * * error ) /* {{{ */
25092509{
25102510 static const char halt_stub [] = "__HALT_COMPILER();" ;
25112511
@@ -2533,31 +2533,29 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
25332533 if (error ) {
25342534 spprintf (error , 0 , "internal error: attempt to flush cached zip-based phar \"%s\"" , phar -> fname );
25352535 }
2536- return ;
2536+ return EOF ;
25372537 }
25382538
25392539 if (error ) {
25402540 * error = NULL ;
25412541 }
25422542
25432543 if (!zend_hash_num_elements (& phar -> manifest ) && !user_stub ) {
2544- return ;
2544+ return EOF ;
25452545 }
25462546
25472547 zend_hash_clean (& phar -> virtual_dirs );
25482548
25492549 if (phar -> is_zip ) {
2550- phar_zip_flush (phar , user_stub , is_default_stub , error );
2551- return ;
2550+ return phar_zip_flush (phar , user_stub , is_default_stub , error );
25522551 }
25532552
25542553 if (phar -> is_tar ) {
2555- phar_tar_flush (phar , user_stub , is_default_stub , error );
2556- return ;
2554+ return phar_tar_flush (phar , user_stub , is_default_stub , error );
25572555 }
25582556
25592557 if (PHAR_G (readonly )) {
2560- return ;
2558+ return EOF ;
25612559 }
25622560
25632561 if (phar -> fp && !phar -> is_brandnew ) {
@@ -2576,7 +2574,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
25762574 if (must_close_old_file ) {
25772575 php_stream_close (oldfile );
25782576 }
2579- return ;
2577+ return EOF ;
25802578 }
25812579
25822580 if (user_stub ) {
@@ -2590,7 +2588,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
25902588 if (error ) {
25912589 spprintf (error , 0 , "illegal stub for phar \"%s\" (__HALT_COMPILER(); is missing)" , phar -> fname );
25922590 }
2593- return ;
2591+ return EOF ;
25942592 }
25952593
25962594 size_t len = pos - ZSTR_VAL (user_stub ) + strlen (halt_stub );
@@ -2608,7 +2606,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
26082606 if (error ) {
26092607 spprintf (error , 0 , "unable to create stub from string in new phar \"%s\"" , phar -> fname );
26102608 }
2611- return ;
2609+ return EOF ;
26122610 }
26132611 phar -> halt_offset = len + end_sequence_len ;
26142612 } else {
@@ -2638,7 +2636,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
26382636 if (new_stub ) {
26392637 zend_string_free (new_stub );
26402638 }
2641- return ;
2639+ return EOF ;
26422640 }
26432641 if (new_stub ) {
26442642 zend_string_free (new_stub );
@@ -2734,7 +2732,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
27342732 if (error ) {
27352733 spprintf (error , 0 , "unable to seek to start of file \"%s\" while creating new phar \"%s\"" , entry -> filename , phar -> fname );
27362734 }
2737- return ;
2735+ return EOF ;
27382736 }
27392737 newcrc32 = php_crc32_bulk_init ();
27402738 php_crc32_stream_bulk_update (& newcrc32 , file , entry -> uncompressed_filesize );
@@ -2760,7 +2758,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
27602758 spprintf (error , 0 , "unable to bzip2 compress file \"%s\" to new phar \"%s\"" , entry -> filename , phar -> fname );
27612759 }
27622760 }
2763- return ;
2761+ return EOF ;
27642762 }
27652763
27662764 /* create new file that holds the compressed versions */
@@ -3086,7 +3084,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
30863084 php_stream_close (oldfile );
30873085 }
30883086 php_stream_close (newfile );
3089- return ;
3087+ return EOF ;
30903088 }
30913089
30923090 php_stream_write (newfile , digest , digest_len );
@@ -3138,7 +3136,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
31383136 if (error ) {
31393137 spprintf (error , 4096 , "unable to open new phar \"%s\" for writing" , phar -> fname );
31403138 }
3141- return ;
3139+ return EOF ;
31423140 }
31433141
31443142 if (phar -> flags & PHAR_FILE_COMPRESSED_GZ ) {
@@ -3154,7 +3152,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
31543152 if (error ) {
31553153 spprintf (error , 4096 , "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib" , phar -> fname );
31563154 }
3157- return ;
3155+ return EOF ;
31583156 }
31593157
31603158 php_stream_filter_append (& phar -> fp -> writefilters , filter );
@@ -3184,9 +3182,10 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
31843182 if (error ) {
31853183 spprintf (error , 0 , "unable to seek to __HALT_COMPILER(); in new phar \"%s\"" , phar -> fname );
31863184 }
3185+ return EOF ;
31873186 }
31883187
3189- return ;
3188+ return EOF ;
31903189
31913190cleanup :
31923191 if (shared_cfp != NULL ) {
@@ -3198,6 +3197,8 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
31983197 entry -> header_offset = 0 ;
31993198 }
32003199 } ZEND_HASH_FOREACH_END ();
3200+
3201+ return EOF ;
32013202}
32023203/* }}} */
32033204
0 commit comments