PHP8 critical error using bulk assign function
-
I found a bug with Delivery Drivers after updating to PHP8. It gives a critical error when using the bulk assign function in WooCommece Orders admin.
wp-content/plugins/delivery-drivers-for-woocommerce/admin/class-ddwc-admin.php, function ddwc_driver_edit_handle_bulk_action
The “INPUT_REQUEST” constant was never created but php7 must have allowed it. Changing to INPUT_GET in 4 places fixed the problem. You can edit this code to make the error go away.
The lines commented out with // are the old version. The line below it is the updated version.
// Only run code if the bulk action is changing to Driver Assigned.
//if ( null !== filter_input( INPUT_REQUEST, ‘mark_driver-assigned’ ) && 1 == filter_input( INPUT_REQUEST, ‘changed’ ) ) {
if ( null !== filter_input( INPUT_GET, ‘mark_driver-assigned’ ) && 1 == filter_input( INPUT_GET, ‘changed’ ) ) {
// Get order.
$order = new WC_Order( $post_id );
// Order note.
$order_note = esc_attr__( ‘That\’s what happened by bulk edit:’, ‘delivery-drivers-for-woocommerce’ );
// Update order status.
$order->update_status( ‘driver-assigned’, $order_note, true );
// Save order.
$order->save();
// Action hook.
do_action( ‘ddwc_mark_driver_assigned’, $post_id );
}
I tried sending this fix to the developer but I think the project has been abandoned. I hope others find this fix useful.
- The topic ‘PHP8 critical error using bulk assign function’ is closed to new replies.