If command triggering at wrong time with PHP 8.1
-
I'm trying to migrate my PHP code which is working on PHP 7.4 to PHP 8.1. With PHP 8.1, following
if($message_id == "") {
code is triggering for logged in users too. Can somebody point out common errors in this code?
require_once("inc_common.php");
include($engine_path."users_get_list.php");
set_variable("message_id");
set_variable("send_to");
set_variable("send_to_id");
$send_to_id = intval($send_to_id);
if (!$exists) {
$error_text = "$w_no_user";
include($file_path."designes/".$design."/error_page.php");
exit;
}$u_ids = array();
$u_names = array();
$tmp_body = "";
$tmp_subject = "";$info_message = "";
if($message_id == "") {
if ($send_to!="") {
$user_to_search = $send_to;
include($ld_engine_path."users_search.php");
if (!count($u_ids)) $info_message = "".str_replace("~",""".htmlspecialchars($send_to).""",$w_search_no_found)."
";
}
if ($send_to_id!="") {
include("inc_user_class.php");
$ttt = $is_regist;
$is_regist = $send_to_id; #fake again :(
include($ld_engine_path."users_get_object.php");
$u_ids[] = $is_regist;
$is_regist = $ttt;
$u_names[] = $current_user->nickname;
}
}
else {
$board_operation = "reply";
$id = $message_id;
include($ld_engine_path."board_process_message.php");
$u_ids[] = $board_message["from_id"];
$u_names[] = $board_message["from"];
$tmp_body = str_replace("
","\n",$board_message["body"]);
$tmp_body = "\n\n_______ ".str_replace("~", $board_message["from"], $w_user_wrote)." ______\n$tmp_body";
$tmp_subject = str_replace("\"",""","Re: ".$board_message["subject"]);
}include($file_path."designes/".$design."/board_send.php");
-
I'm trying to migrate my PHP code which is working on PHP 7.4 to PHP 8.1. With PHP 8.1, following
if($message_id == "") {
code is triggering for logged in users too. Can somebody point out common errors in this code?
require_once("inc_common.php");
include($engine_path."users_get_list.php");
set_variable("message_id");
set_variable("send_to");
set_variable("send_to_id");
$send_to_id = intval($send_to_id);
if (!$exists) {
$error_text = "$w_no_user";
include($file_path."designes/".$design."/error_page.php");
exit;
}$u_ids = array();
$u_names = array();
$tmp_body = "";
$tmp_subject = "";$info_message = "";
if($message_id == "") {
if ($send_to!="") {
$user_to_search = $send_to;
include($ld_engine_path."users_search.php");
if (!count($u_ids)) $info_message = "".str_replace("~",""".htmlspecialchars($send_to).""",$w_search_no_found)."
";
}
if ($send_to_id!="") {
include("inc_user_class.php");
$ttt = $is_regist;
$is_regist = $send_to_id; #fake again :(
include($ld_engine_path."users_get_object.php");
$u_ids[] = $is_regist;
$is_regist = $ttt;
$u_names[] = $current_user->nickname;
}
}
else {
$board_operation = "reply";
$id = $message_id;
include($ld_engine_path."board_process_message.php");
$u_ids[] = $board_message["from_id"];
$u_names[] = $board_message["from"];
$tmp_body = str_replace("
","\n",$board_message["body"]);
$tmp_body = "\n\n_______ ".str_replace("~", $board_message["from"], $w_user_wrote)." ______\n$tmp_body";
$tmp_subject = str_replace("\"",""","Re: ".$board_message["subject"]);
}include($file_path."designes/".$design."/board_send.php");
The only place that variable is mentioned prior to the test is the
set_variable("message_id");
line. As far as I can see, that's not a built-in PHP function. So you need to check what that function is doing, and try to work out why its behaviour has changed in PHP 8. We can't do that for you, since we can't see the function.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
The only place that variable is mentioned prior to the test is the
set_variable("message_id");
line. As far as I can see, that's not a built-in PHP function. So you need to check what that function is doing, and try to work out why its behaviour has changed in PHP 8. We can't do that for you, since we can't see the function.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
The only place that variable is mentioned prior to the test is the
set_variable("message_id");
line. As far as I can see, that's not a built-in PHP function. So you need to check what that function is doing, and try to work out why its behaviour has changed in PHP 8. We can't do that for you, since we can't see the function.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer