Correct the set_time_limit if

This commit is contained in:
Flavio Copes
2015-11-26 16:18:05 +01:00
parent ae39aabee1
commit 43783f3ce6
2 changed files with 27 additions and 2 deletions

View File

@@ -78,8 +78,11 @@ class Response
throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available');
}
// check if this function is available, if so use it to stop any timeouts
try {
set_time_limit(0);
if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode') && function_exists('set_time_limit')) {
set_time_limit(0);
}
} catch (\Exception $e) {}
$options = array_replace_recursive(self::$defaults, $options);

View File

@@ -218,8 +218,11 @@ abstract class Utils
$file_parts = pathinfo($file);
$filesize = filesize($file);
// check if this function is available, if so use it to stop any timeouts
try {
set_time_limit(0);
if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode') && function_exists('set_time_limit')) {
set_time_limit(0);
}
} catch (\Exception $e) {}
ignore_user_abort(false);
@@ -410,6 +413,25 @@ abstract class Utils
}
}
/**
* Get value of an array using dot notation
*/
public static function resolve(array $array, $path, $default = null)
{
$current = $array;
$p = strtok($path, '.');
while ($p !== false) {
if (!isset($current[$p])) {
return $default;
}
$current = $current[$p];
$p = strtok('.');
}
return $current;
}
/**
* Checks if a value is positive
*