@@ -667,7 +667,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
667667/**
668668 * Unlink a file within a phar archive
669669 */
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 ) /* {{{ */
671671{
672672 php_url * resource ;
673673 char * internal_file , * error ;
@@ -676,22 +676,22 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
676676 phar_archive_data * pphar ;
677677 uint32_t host_len ;
678678
679- if ((resource = phar_parse_url (wrapper , url , "rb" , options )) == NULL ) {
679+ if ((resource = phar_parse_url (wrapper , ZSTR_VAL ( url ) , "rb" , options )) == NULL ) {
680680 php_stream_wrapper_log_error (wrapper , options , "phar error: unlink failed" );
681- return 0 ;
681+ return false ;
682682 }
683683
684684 /* we must have at the very least phar://alias.phar/internalfile.php */
685685 if (!resource -> scheme || !resource -> host || !resource -> path ) {
686686 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 ;
689689 }
690690
691691 if (!zend_string_equals_literal_ci (resource -> scheme , "phar" )) {
692692 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 ;
695695 }
696696
697697 host_len = ZSTR_LEN (resource -> host );
@@ -710,14 +710,14 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
710710 if (FAILURE == phar_get_entry_data (& idata , ZSTR_VAL (resource -> host ), host_len , internal_file , internal_file_len , "r" , 0 , & error , 1 )) {
711711 /* constraints of fp refcount were not met */
712712 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 );
714714 efree (error );
715715 } 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 ) );
717717 }
718718 efree (internal_file );
719719 php_url_free (resource );
720- return 0 ;
720+ return false ;
721721 }
722722 if (error ) {
723723 efree (error );
@@ -728,7 +728,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
728728 efree (internal_file );
729729 php_url_free (resource );
730730 phar_entry_delref (idata );
731- return 0 ;
731+ return false ;
732732 }
733733 php_url_free (resource );
734734 efree (internal_file );
@@ -737,7 +737,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
737737 php_stream_wrapper_log_error (wrapper , options , "%s" , error );
738738 efree (error );
739739 }
740- return 1 ;
740+ return true ;
741741}
742742/* }}} */
743743
0 commit comments