Upgrade to 3.8.1

This commit is contained in:
Bastian Allgeier
2022-10-18 14:11:15 +02:00
parent 94b2a32baf
commit 9c93e01c3a
71 changed files with 633 additions and 5705 deletions

View File

@@ -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;
}
/**

View File

@@ -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);

View File

@@ -323,9 +323,9 @@ class Remote
{
if (is_object($data) || is_array($data)) {
return http_build_query($data);
} else {
return $data;
}
return $data;
}
/**

View File

@@ -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
*