fix some longstanding bugs and stamp out deprecation warnings

This commit is contained in:
Michael Becker 2025-12-04 19:17:31 -05:00
parent abcf832f47
commit 4bb5738075
3 changed files with 80 additions and 56 deletions

View File

@ -323,10 +323,10 @@
$this->resParser = \xml_parser_create (); $this->resParser = \xml_parser_create ();
\xml_parser_set_option($this->resParser, XML_OPTION_CASE_FOLDING, 0); \xml_parser_set_option($this->resParser, XML_OPTION_CASE_FOLDING, 0);
\xml_set_object($this->resParser, $this); // \xml_set_object($this->resParser, $this);
\xml_set_element_handler($this->resParser, "tagOpen", "tagClosed"); \xml_set_element_handler($this->resParser, $this->tagOpen(...), $this->tagClosed(...));
\xml_set_character_data_handler($this->resParser, "tagData"); \xml_set_character_data_handler($this->resParser, $this->tagData(...));
$this->strXmlData = \xml_parse($this->resParser, $input); $this->strXmlData = \xml_parse($this->resParser, $input);
if(!$this->strXmlData) if(!$this->strXmlData)
@ -336,7 +336,9 @@
die(sprintf("XML error: %s at line %d", $message, $lineNumber)); die(sprintf("XML error: %s at line %d", $message, $lineNumber));
} }
if (PHP_VERSION_ID < 80000) {
\xml_parser_free($this->resParser); \xml_parser_free($this->resParser);
}
return MarkupObjectModel::FromArray($this->mvarOutput); return MarkupObjectModel::FromArray($this->mvarOutput);
} }

View File

@ -621,7 +621,7 @@
return $_GET["virtualpath"]; return $_GET["virtualpath"];
} }
} }
return null; return "";
} }
public static function IncludeFile($filename, $isRequired) public static function IncludeFile($filename, $isRequired)
{ {
@ -882,6 +882,17 @@
*/ */
public static function ParsePathVariables(string $template, string $pathstr) public static function ParsePathVariables(string $template, string $pathstr)
{ {
if ($pathstr == "")
{
if ($template == "")
{
return [ ];
}
else
{
return false;
}
}
$l = strlen($template); $l = strlen($template);
$i = 0; $i = 0;
@ -1056,9 +1067,11 @@
} }
$path = System::GetVirtualPath(); $path = System::GetVirtualPath();
if (System::$Configuration["Runtime.DisableAutomaticExtensionParsing"] !== true) if (System::GetConfigurationValue("Runtime.DisableAutomaticExtensionParsing") !== true)
{ {
// strip path extension if there is one // strip path extension if there is one
if (count($path) > 0)
{
$pathLast = $path[count($path) - 1]; $pathLast = $path[count($path) - 1];
$ix = strripos($pathLast, "."); $ix = strripos($pathLast, ".");
if ($ix !== false) if ($ix !== false)
@ -1100,6 +1113,7 @@
} }
} }
} }
}
$success = false; $success = false;
@ -1138,7 +1152,7 @@
if (!$success) if (!$success)
{ {
$retval = call_user_func(System::$ErrorEventHandler, new ErrorEventArgs("The specified resource is not available on this server. (" . (System::$EnableTenantedHosting ? ("Tenanted - " . System::GetTenantName()) : "Non-Tenanted") . ")<br />Path: " . $_GET["virtualpath"])); $retval = call_user_func(System::$ErrorEventHandler, new ErrorEventArgs("The specified resource is not available on this server. (" . (System::$EnableTenantedHosting ? ("Tenanted - " . System::GetTenantName()) : "Non-Tenanted") . ")<br />Path: " . (isset($_GET["virtualpath"]) ? $_GET["virtualpath"] : "")));
return false; return false;
} }
return true; return true;

View File

@ -59,6 +59,8 @@
{ {
$path = System::GetVirtualPath(); $path = System::GetVirtualPath();
// strip path extension if there is one // strip path extension if there is one
if (count($path) > 0)
{
$pathLast = $path[count($path) - 1]; $pathLast = $path[count($path) - 1];
$ix = strripos($pathLast, "."); $ix = strripos($pathLast, ".");
if ($ix !== false) if ($ix !== false)
@ -66,6 +68,7 @@
$pathExt = substr($pathLast, $ix + 1); $pathExt = substr($pathLast, $ix + 1);
$path[count($path) - 1] = substr($pathLast, 0, $ix); $path[count($path) - 1] = substr($pathLast, 0, $ix);
} }
}
return System::ExpandRelativePath("~/" . implode("/", $path)); return System::ExpandRelativePath("~/" . implode("/", $path));
} }
@ -557,10 +560,10 @@
} }
$initializingEventArgs = new CancelEventArgs(); $initializingEventArgs = new CancelEventArgs();
$initializingEventArgs->RenderingPage = $renderingPage; // $initializingEventArgs->RenderingPage = $renderingPage;
$initializedEventArgs = new EventArgs(); $initializedEventArgs = new EventArgs();
$initializedEventArgs->RenderingPage = $renderingPage; // $initializedEventArgs->RenderingPage = $renderingPage;
if (method_exists($this, "OnInitializing")) if (method_exists($this, "OnInitializing"))
{ {
@ -941,11 +944,14 @@
if ($e->Cancel) if ($e->Cancel)
return; return;
if ($this->ClassReference != null)
{
if (method_exists($this->ClassReference, "OnPreRender")) if (method_exists($this->ClassReference, "OnPreRender"))
{ {
$retval = $this->ClassReference->OnPreRender($e); $retval = $this->ClassReference->OnPreRender($e);
if ($e->Cancel) return; if ($e->Cancel) return;
} }
}
$handled = false; $handled = false;
@ -1300,7 +1306,8 @@
} }
} }
if ($this->ClassReference != null)
{
if (method_exists($this->ClassReference, "RenderContents")) if (method_exists($this->ClassReference, "RenderContents"))
{ {
ob_start(); ob_start();
@ -1308,6 +1315,7 @@
$tagBODY->Content = ob_get_contents(); $tagBODY->Content = ob_get_contents();
ob_end_clean(); ob_end_clean();
} }
}
$tagHTML->Controls[] = $tagBODY; $tagHTML->Controls[] = $tagBODY;
$tagHTML->Render(); $tagHTML->Render();