diff --git a/includes/admin/importers/class-wc-tax-rate-importer.php b/includes/admin/importers/class-wc-tax-rate-importer.php index 6fac7b2cd66..4e24bfaabd0 100644 --- a/includes/admin/importers/class-wc-tax-rate-importer.php +++ b/includes/admin/importers/class-wc-tax-rate-importer.php @@ -75,7 +75,9 @@ class WC_Tax_Rate_Importer extends WP_Importer { if ( function_exists( 'gc_enable' ) ) { gc_enable(); } - @set_time_limit(0); + if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { + set_time_limit( 0 ); + } @ob_flush(); @flush(); @ini_set( 'auto_detect_line_endings', '1' ); diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index cacfdcc3e3c..8012d5565dd 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -844,7 +844,9 @@ class WC_AJAX { die(-1); } - @set_time_limit(0); + if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { + set_time_limit( 0 ); + } $post_id = intval( $_POST['post_id'] ); diff --git a/includes/class-wc-download-handler.php b/includes/class-wc-download-handler.php index f2f5a7484ac..4171d5b1f7f 100644 --- a/includes/class-wc-download-handler.php +++ b/includes/class-wc-download-handler.php @@ -338,11 +338,11 @@ class WC_Download_Handler { * Check and set certain server config variables to ensure downloads work as intended. */ private static function check_server_config() { - if ( ! ini_get('safe_mode') ) { - @set_time_limit(0); + if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { + set_time_limit( 0 ); } - if ( function_exists( 'get_magic_quotes_runtime' ) && get_magic_quotes_runtime() ) { - @set_magic_quotes_runtime(0); + if ( function_exists( 'get_magic_quotes_runtime' ) && get_magic_quotes_runtime() && version_compare( phpversion(), '5.4', '<' ) ) { + set_magic_quotes_runtime( 0 ); } if ( function_exists( 'apache_setenv' ) ) { @apache_setenv( 'no-gzip', 1 );