mirror of
https://github.com/openvk/openvk
synced 2025-06-07 22:59:58 +03:00
fix(saveProfileInfo): fix value overflow
This commit is contained in:
parent
911e03980c
commit
782046349a
1 changed files with 8 additions and 3 deletions
|
@ -138,13 +138,13 @@ final class Account extends VKAPIRequestHandler
|
||||||
$user->setSex($sex == 1 ? 1 : 0);
|
$user->setSex($sex == 1 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($relation > -1) {
|
if ($relation > -1 && $relation <= 8) {
|
||||||
$user->setMarital_Status($relation);
|
$user->setMarital_Status($relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($bdate)) {
|
if (!empty($bdate)) {
|
||||||
$birthday = strtotime($bdate);
|
$birthday = strtotime($bdate);
|
||||||
if (!is_int($birthday)) {
|
if (!is_int($birthday) || $birthday > time()) {
|
||||||
$this->fail(100, "invalid value of bdate.");
|
$this->fail(100, "invalid value of bdate.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,12 @@ final class Account extends VKAPIRequestHandler
|
||||||
|
|
||||||
if ($sex > 0 || $relation > -1 || $bdate_visibility > 1 || !empty("$first_name$last_name$screen_name$bdate$home_town$status")) {
|
if ($sex > 0 || $relation > -1 || $bdate_visibility > 1 || !empty("$first_name$last_name$screen_name$bdate$home_town$status")) {
|
||||||
$output["changed"] = 1;
|
$output["changed"] = 1;
|
||||||
|
|
||||||
|
try {
|
||||||
$user->save();
|
$user->save();
|
||||||
|
} catch(\TypeError $e) {
|
||||||
|
$output["changed"] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object) $output;
|
return (object) $output;
|
||||||
|
|
Loading…
Reference in a new issue