Fixed defaults handling.
This commit is contained in:
parent
d86291abf8
commit
3684fc3b0c
2 changed files with 8 additions and 8 deletions
|
@ -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)));
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue