@@ -667,7 +667,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
667
667
/**
668
668
* Unlink a file within a phar archive
669
669
*/
670
- static int phar_wrapper_unlink (php_stream_wrapper * wrapper , const char * url , int options , php_stream_context * context ) /* {{{ */
670
+ static bool phar_wrapper_unlink (php_stream_wrapper * wrapper , const zend_string * url , int options , php_stream_context * context ) /* {{{ */
671
671
{
672
672
php_url * resource ;
673
673
char * internal_file , * error ;
@@ -676,22 +676,22 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
676
676
phar_archive_data * pphar ;
677
677
uint32_t host_len ;
678
678
679
- if ((resource = phar_parse_url (wrapper , url , "rb" , options )) == NULL ) {
679
+ if ((resource = phar_parse_url (wrapper , ZSTR_VAL ( url ) , "rb" , options )) == NULL ) {
680
680
php_stream_wrapper_log_error (wrapper , options , "phar error: unlink failed" );
681
- return 0 ;
681
+ return false ;
682
682
}
683
683
684
684
/* we must have at the very least phar://alias.phar/internalfile.php */
685
685
if (!resource -> scheme || !resource -> host || !resource -> path ) {
686
686
php_url_free (resource );
687
- php_stream_wrapper_log_error (wrapper , options , "phar error: invalid url \"%s\"" , url );
688
- return 0 ;
687
+ php_stream_wrapper_log_error (wrapper , options , "phar error: invalid url \"%s\"" , ZSTR_VAL ( url ) );
688
+ return false ;
689
689
}
690
690
691
691
if (!zend_string_equals_literal_ci (resource -> scheme , "phar" )) {
692
692
php_url_free (resource );
693
- php_stream_wrapper_log_error (wrapper , options , "phar error: not a phar stream url \"%s\"" , url );
694
- return 0 ;
693
+ php_stream_wrapper_log_error (wrapper , options , "phar error: not a phar stream url \"%s\"" , ZSTR_VAL ( url ) );
694
+ return false ;
695
695
}
696
696
697
697
host_len = ZSTR_LEN (resource -> host );
@@ -710,14 +710,14 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
710
710
if (FAILURE == phar_get_entry_data (& idata , ZSTR_VAL (resource -> host ), host_len , internal_file , internal_file_len , "r" , 0 , & error , 1 )) {
711
711
/* constraints of fp refcount were not met */
712
712
if (error ) {
713
- php_stream_wrapper_log_error (wrapper , options , "unlink of \"%s\" failed: %s" , url , error );
713
+ php_stream_wrapper_log_error (wrapper , options , "unlink of \"%s\" failed: %s" , ZSTR_VAL ( url ) , error );
714
714
efree (error );
715
715
} else {
716
- php_stream_wrapper_log_error (wrapper , options , "unlink of \"%s\" failed, file does not exist" , url );
716
+ php_stream_wrapper_log_error (wrapper , options , "unlink of \"%s\" failed, file does not exist" , ZSTR_VAL ( url ) );
717
717
}
718
718
efree (internal_file );
719
719
php_url_free (resource );
720
- return 0 ;
720
+ return false ;
721
721
}
722
722
if (error ) {
723
723
efree (error );
@@ -728,7 +728,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
728
728
efree (internal_file );
729
729
php_url_free (resource );
730
730
phar_entry_delref (idata );
731
- return 0 ;
731
+ return false ;
732
732
}
733
733
php_url_free (resource );
734
734
efree (internal_file );
@@ -737,7 +737,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
737
737
php_stream_wrapper_log_error (wrapper , options , "%s" , error );
738
738
efree (error );
739
739
}
740
- return 1 ;
740
+ return true ;
741
741
}
742
742
/* }}} */
743
743
0 commit comments