[web-php] master: Combine consecutive issets
| From: | Mathias Reker ⚡️ via GitHub | Date: | Fri, 17 Jun 2022 14:34:39 +0000 |
| Subject: | [web-php] master: Combine consecutive issets | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30086@lists.php.net to get a copy of this message | ||
Author: Mathias Reker ⚡️ (MathiasReker)
Committer: GitHub (web-flow)
Pusher: cmb69
Date: 2022-06-17T16:29:04+02:00
Commit: https://github.com/php/web-php/commit/11866535bfec72743420123f34f5dc8d864d1a7c
Raw diff: https://github.com/php/web-php/commit/11866535bfec72743420123f34f5dc8d864d1a7c.diff
Combine consecutive issets
Using isset($var) && multiple times should be done in one call.
Co-authored-by: Andreas Möller <am@localheinz.com>
Closes GH-542.
Changed paths:
M manual/vote-note.php
M my.php
Diff:
diff --git a/manual/vote-note.php b/manual/vote-note.php
index 787d96b8c..a9600eb4b 100644
--- a/manual/vote-note.php
+++ b/manual/vote-note.php
@@ -42,7 +42,7 @@
if (json_last_error() == JSON_ERROR_NONE && isset($r->status) &&
$r->status && isset($r->votes)) {
$response["success"] = true;
$response["update"] = (int)$r->votes;
- } elseif (json_last_error() == JSON_ERROR_NONE && isset($r->status) &&
isset($r->message) && $r->status == false) {
+ } elseif (json_last_error() == JSON_ERROR_NONE && isset($r->status,
$r->message) && $r->status == false) {
$response["success"] = false;
$response["msg"] = $r->message;
} else {
diff --git a/my.php b/my.php
index 428a8846d..67fd2bdeb 100644
--- a/my.php
+++ b/my.php
@@ -10,7 +10,7 @@
$options = array();
// We have post data, and it is an available language
-if (isset($_POST['my_lang']) && isset($langs[$_POST['my_lang']])) {
+if (isset($_POST['my_lang'], $langs[$_POST['my_lang']])) {
// Set the language preference
myphpnet_language($_POST['my_lang']);