فهرست منبع

persistformvar [Function]: Updates for PHP 8.1

fusionate 2 سال پیش
والد
کامیت
74e37a852b
1فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 5 5
      resources/persist_form_var.php

+ 5 - 5
resources/persist_form_var.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2023
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -28,11 +28,11 @@ function persistformvar($form_array) {
 	// Remember Form Input Values
 	$content = '';
 	if (!empty($form_array)) {
-		$content .= "<form method='post' action='".escape($_SERVER["HTTP_REFERER"])."' target='_self'>\n";
-		foreach($form_array as $key => $val) {
+		$content .= "<form method='post' action='".escape($_SERVER["HTTP_REFERER"] ?? '')."' target='_self'>\n";
+		foreach ($form_array as $key => $val) {
 			if ($key == "XID" || $key == "ACT" || $key == "RET") continue;
 			if ($key != "persistform") { //clears the persistform value
-				$content .= "	<input type='hidden' name='".escape($key)."' value='".escape($val)."' />\n";
+				$content .= "	<input type='hidden' name='".escape($key ?? '')."' value='".(!is_array($val) ? escape($val ?? '') : null)."' />\n";
 			}
 		}
 		$content .= "	<input type='hidden' name='persistformvar' value='true' />\n"; //sets persistform to yes
@@ -45,4 +45,4 @@ function persistformvar($form_array) {
 //persistformvar($_POST);
 //persistformvar($_GET);
 
-?>
+?>