@@ -2533,7 +2533,6 @@ int phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defau
25332533{
25342534 static const char halt_stub [] = "__HALT_COMPILER();" ;
25352535
2536- zend_string * newstub ;
25372536 phar_entry_info * entry , * newentry ;
25382537 size_t halt_offset ;
25392538 int restore_alias_len , global_flags = 0 ;
@@ -2636,35 +2635,35 @@ int phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defau
26362635 phar -> halt_offset = len + end_sequence_len ;
26372636 } else {
26382637 size_t written ;
2638+ zend_string * new_stub = NULL ;
26392639
26402640 if (!user_stub && phar -> halt_offset && oldfile && !phar -> is_brandnew ) {
26412641 php_stream_copy_to_stream_ex (oldfile , newfile , phar -> halt_offset , & written );
2642- newstub = NULL ;
26432642 } else {
26442643 /* this is either a brand new phar or a default stub overwrite */
2645- newstub = phar_create_default_stub (NULL , NULL , NULL );
2646- phar -> halt_offset = ZSTR_LEN (newstub );
2647- written = php_stream_write (newfile , ZSTR_VAL (newstub ), phar -> halt_offset );
2644+ new_stub = phar_create_default_stub (NULL , NULL , NULL );
2645+ phar -> halt_offset = ZSTR_LEN (new_stub );
2646+ written = php_stream_write (newfile , ZSTR_VAL (new_stub ), phar -> halt_offset );
26482647 }
26492648 if (phar -> halt_offset != written ) {
26502649 if (must_close_old_file ) {
26512650 php_stream_close (oldfile );
26522651 }
26532652 php_stream_close (newfile );
26542653 if (error ) {
2655- if (newstub ) {
2654+ if (new_stub ) {
26562655 spprintf (error , 0 , "unable to create stub in new phar \"%s\"" , phar -> fname );
26572656 } else {
26582657 spprintf (error , 0 , "unable to copy stub of old phar to new phar \"%s\"" , phar -> fname );
26592658 }
26602659 }
2661- if (newstub ) {
2662- zend_string_free (newstub );
2660+ if (new_stub ) {
2661+ zend_string_free (new_stub );
26632662 }
26642663 return EOF ;
26652664 }
2666- if (newstub ) {
2667- zend_string_free (newstub );
2665+ if (new_stub ) {
2666+ zend_string_free (new_stub );
26682667 }
26692668 }
26702669 manifest_ftell = php_stream_tell (newfile );
0 commit comments