Remove typecasting to prevent fatal when $screen_id is null. (#34734)

This commit is contained in:
Vedanshu Jain 2022-09-20 15:52:29 +05:30 committed by GitHub
parent 0b62bf85bd
commit c08551cd13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Remove typecasting to prevent fatal when $screen_id is null.

View File

@ -305,7 +305,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
)
);
}
if ( in_array( str_replace( 'edit-', '', $screen_id ), array( 'shop_coupon', 'product' ) ) || $this->is_order_meta_box_screen( $screen_id ) ) {
if ( in_array( str_replace( 'edit-', '', $screen_id ), array( 'shop_coupon', 'product' ), true ) || $this->is_order_meta_box_screen( $screen_id ) ) {
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
@ -507,8 +507,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
*
* @return bool Whether the current screen is an order edit screen.
*/
private function is_order_meta_box_screen( string $screen_id ) {
return in_array( str_replace( 'edit-', '', $screen_id ), wc_get_order_types( 'order-meta-boxes' ) ) ||
private function is_order_meta_box_screen( $screen_id ) {
return in_array( str_replace( 'edit-', '', $screen_id ), wc_get_order_types( 'order-meta-boxes' ), true ) ||
wc_get_page_screen_id( 'shop-order' ) === $screen_id;
}