[wp-trac] [WordPress Trac] #50849: Incorrect action passed to hooks when updating plugin/theme by uploading ZIP file

WordPress Trac noreply at wordpress.org
Fri Jun 11 12:08:54 UTC 2021


#50849: Incorrect action passed to hooks when updating plugin/theme by uploading
ZIP file
-------------------------------------+-----------------------------
 Reporter:  desrosj                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Upgrade/Install          |     Version:  5.5
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------------

Comment (by desrosj):

 Hi @justinahinon! Good point. Here are some steps to test:

 Attach a function to the `upgrader_process_complete` action hook that will
 log information. This should print the contents of the second parameter to
 the debug log:

 {{{
 add_action( 'upgrader_process_complete', function( $upgrader, $hook_info )
 {
 error_log( print_r( $hook_info, true ) );
 }, 10, 2 );
 }}}

 - Attempt to upgrade and downgrade a plugin and theme by uploading a zip
 file.
 - The information should print to the log twice: once after uploading the
 zip, and once after clicking the confirmation to replace the installed
 version with the uploaded version.
 - Also, observe that the `action` index of the array is always `install`.
 - Apply patch and repeat.
 - Information should only be printed once, and only after clicking the
 confirmation (the upload completing does not signify a "complete" process.
 - The `action` should now be set to `upgrade-plugin|theme` or `downgrade-
 plugin|theme`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50849#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list