Upgrade to 3.8.1
This commit is contained in:
@@ -73,12 +73,14 @@ class Cookie
|
||||
if ($minutes > 1000000000) {
|
||||
// absolute timestamp
|
||||
return $minutes;
|
||||
} elseif ($minutes > 0) {
|
||||
}
|
||||
|
||||
if ($minutes > 0) {
|
||||
// minutes from now
|
||||
return time() + ($minutes * 60);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -786,12 +786,20 @@ class Environment
|
||||
|
||||
// load the config for the host
|
||||
if (empty($host) === false) {
|
||||
$configHost = F::load($root . '/config.' . $host . '.php', []);
|
||||
$configHost = F::load(
|
||||
file: $root . '/config.' . $host . '.php',
|
||||
fallback: [],
|
||||
allowOutput: false
|
||||
);
|
||||
}
|
||||
|
||||
// load the config for the server IP
|
||||
if (empty($addr) === false) {
|
||||
$configAddr = F::load($root . '/config.' . $addr . '.php', []);
|
||||
$configAddr = F::load(
|
||||
file: $root . '/config.' . $addr . '.php',
|
||||
fallback: [],
|
||||
allowOutput: false
|
||||
);
|
||||
}
|
||||
|
||||
return array_replace_recursive($configHost, $configAddr);
|
||||
|
@@ -323,9 +323,9 @@ class Remote
|
||||
{
|
||||
if (is_object($data) || is_array($data)) {
|
||||
return http_build_query($data);
|
||||
} else {
|
||||
return $data;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Kirby\Http;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Filesystem\F;
|
||||
use Throwable;
|
||||
|
||||
@@ -182,6 +184,23 @@ class Response
|
||||
die(static::redirect($url, $code));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the callback does not produce the first body output
|
||||
* (used to show when loading a file creates side effects)
|
||||
*/
|
||||
public static function guardAgainstOutput(Closure $callback, ...$args): mixed
|
||||
{
|
||||
$before = headers_sent();
|
||||
$result = $callback(...$args);
|
||||
$after = headers_sent($file, $line);
|
||||
|
||||
if ($before === false && $after === true) {
|
||||
throw new LogicException("Disallowed output from file $file:$line, possible accidental whitespace?");
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for single headers
|
||||
*
|
||||
|
Reference in New Issue
Block a user