[wp-trac] [WordPress Trac] #37570: Parameter 1 to wp_handle_upload_error() expected to be a reference, value given
WordPress Trac
noreply at wordpress.org
Thu Aug 4 13:49:42 UTC 2016
#37570: Parameter 1 to wp_handle_upload_error() expected to be a reference, value
given
--------------------------+-----------------------------
Reporter: jbrinley | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When calling `media_handle_sideload()` with a failed download, the file
information is passed (in `_wp_handle_upload()` to the upload error
handler, which defaults to `wp_handle_upload_error()`.
In, PHP7 (and maybe earlier), this throws a warning: "PHP Warning:
Parameter 1 to wp_handle_upload_error() expected to be a reference, value
given in /srv/www/public/wp/wp-admin/includes/file.php".
Per the notes at http://php.net/call_user_func, "the parameters for
call_user_func() are not passed by reference", but it provides a
workaround using `call_user_func_array()`.
All of the calls to the error handler should be changed from:
`call_user_func( $upload_error_handler, $file, $error_msg )`
To:
`call_user_func_array( $upload_error_handler, array( &$file, $error_msg )
)`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37570>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list