diff --git a/public/changelog.php b/public/changelog.php index 752b6ea8..ce9152af 100644 --- a/public/changelog.php +++ b/public/changelog.php @@ -3,10 +3,10 @@ use Misuzu\Request\RequestVar; require_once '../misuzu.php'; -$changelogChange = RequestVar::get()->select('c')->int(); -$changelogDate = RequestVar::get()->select('d')->string(); -$changelogUser = RequestVar::get()->select('u')->int(); -$changelogTags = RequestVar::get()->select('t')->string(); +$changelogChange = RequestVar::get()->select('c')->int(0); +$changelogDate = RequestVar::get()->select('d')->string(''); +$changelogUser = RequestVar::get()->select('u')->int(0); +$changelogTags = RequestVar::get()->select('t')->string(''); tpl_var('comments_perms', $commentPerms = comments_get_perms(user_session_current('user_id', 0))); diff --git a/src/Request/RequestVar.php b/src/Request/RequestVar.php index c1e3e1f2..9897261a 100644 --- a/src/Request/RequestVar.php +++ b/src/Request/RequestVar.php @@ -3,7 +3,7 @@ namespace Misuzu\Request; class RequestVar { - private $value; + private $value = null; private $valueCasted = null; private $type; @@ -90,17 +90,17 @@ class RequestVar public function int(?int $default = null): ?int { - return (int)$this->value == $this->value ? (int)$this->value : $default; + return empty($this->value) ? $default : (int)$this->value; } public function bool(?bool $default = null): bool { - return (bool)$this->value == $this->value ? (bool)$this->value : $default; + return empty($this->value) ? $default : (bool)$this->value; } public function float(?float $default = null): float { - return (float)$this->value == $this->value ? (float)$this->value : $default; + return empty($this->value) ? $default : (float)$this->value; } // avoid using when possible