简体   繁体   English

如何解决Joomla网站上的html解析器错误?

[英]How to solve the html parser error on Joomla site?

Hy people, I recently migrated my site to new server and now I am getting an error whenever I go to my front page. 大家好,我最近将网站迁移到了新服务器,现在每次转到首页时都会出现错误。

http://144.130.57.197/MonashHealthNew/beta.monashhealth.org/en/ http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/

Here is the error which I am getting and I have no clue about it: 这是我遇到的错误,我对此一无所知:

parser = xml_parser_create($encoding); 解析器= xml_parser_create($ encoding); xml_set_object($this->parser, &$this); xml_set_object($ this-> parser,&$ this); xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($ this-> parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($ this-> parser,XML_OPTION_SKIP_WHITE,1); xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); xml_parser_set_option($ this-> parser,XML_OPTION_TARGET_ENCODING,'UTF-8'); xml_set_element_handler($this->parser, "start_element", "stop_element"); xml_set_element_handler($ this-> parser,“ start_element”,“ stop_element”); xml_set_character_data_handler($this->parser, "char_data"); xml_set_character_data_handler($ this-> parser,“ char_data”); } function force_to_array() { for ($i = 0; $i < func_num_args(); $i++) { $this->force_to_array[] = func_get_arg($i); }函数force_to_array(){for($ i = 0; $ i <func_num_args(); $ i ++){$ this-> force_to_array [] = func_get_arg($ i); } } /* Parse XML data, storing it in the instance variable; }} / *解析XML数据,并将其存储在实例变量中; returns false if the data cannot be parsed. 如果无法解析数据,则返回false。 */ function parse($data) { $this->tree = array(); * /函数parse($ data){$ this-> tree = array(); if (!xml_parse($this->parser, $data, 1)) { $this->error = "xml parse error: " . 如果(!xml_parse($ this-> parser,$ data,1)){$ this-> error =“ xml解析错误:”。 xml_error_string(xml_get_error_code($this->parser)) . xml_error_string(xml_get_error_code($ this-> parser))。 " on line ".xml_get_current_line_number($this->parser); “在线”上。“。xml_get_current_line_number($ this-> parser); return false; 返回false; } return $this->tree[0]["content"]; }返回$ this-> tree [0] [“ content”]; } function parse_file($file) { $fp = @fopen($file, "r"); }函数parse_file($ file){$ fp = @fopen($ file,“ r”); if (!$fp) { user_error("unable to open file: '$file'"); 如果(!$ fp){user_error(“无法打开文件:'$ file'”); return false; 返回false; } while ($data = fread($fp, 4096)) { if (!xml_parse($this->parser, $data, feof($fp))) { user_error("xml parse error: " . xml_error_string(xml_get_error_code($this->parser)) . " on line " . xml_get_current_line_number($this->parser)); } while($ data = fread($ fp,4096)){if(!xml_parse($ this-> parser,$ data,feof($ fp))){user_error(“ xml parse error:”。xml_error_string(xml_get_error_code( $ this-> parser))。“在线”。xml_get_current_line_number($ this-> parser)); } } fclose($fp); }} fclose($ fp); return $this->tree[0]["content"]; 返回$ this-> tree [0] [“ content”]; } function encode_as_xml($value) { if (is_array($value)) { reset($value); }函数encode_as_xml($ value){如果(is_array($ value)){reset($ value); $out = ''; $ out =''; while (list($key,$val) = each($value)) { if (is_array($val) && isset($val[0])) { reset($val); while(list($ key,$ val)= each($ value)){if(is_array($ val)&& isset($ val [0])){reset($ val); while (list(,$item) = each($val)) { $out .= "".xml_simple::encode_as_xml($item).""; while(list(,$ item)= each($ val)){$ out。=“” .xml_simple :: encode_as_xml($ item)。“”; } } else { $out .= "".xml_simple::encode_as_xml($val).""; }}其他{$ out。=“” .xml_simple :: encode_as_xml($ val)。“”; } } return $out; 返回$ out; } else { return htmlspecialchars($value); } else {return htmlspecialchars($ value); } } function start_element($parser, $name, $attrs) { array_unshift($this->tree, array("name" => $name)); }}函数start_element($ parser,$ name,$ attrs){array_unshift($ this-> tree,array(“ name” => $ name)); } function stop_element($parser, $name) { if ($name != $this->tree[0]["name"]) die("incorrect nesting"); }函数stop_element($ parser,$ name){如果($ name!= $ this-> tree [0] [“ name”])die(“不正确的嵌套”); if (count($this->tree) > 1) { $elem = array_shift($this->tree); 如果(count($ this-> tree)> 1){$ elem = array_shift($ this-> tree); if (isset($this->tree[0]["content"][$elem["name"]])) { if (is_array($this->tree[0]["content"][$elem["name"]]) && isset($this->tree[0]["content"][$elem["name"]][0])) { array_push($this->tree[0]["content"][$elem["name"]], $elem["content"]); if(isset($ this-> tree [0] [“ content”] [$ elem [“ name”]]))){if(is_array($ this-> tree [0] [“ content”] [$ elem [ “ name”]])&& isset($ this-> tree [0] [“ content”] [$ elem [“ name”]] [0])){array_push($ this-> tree [0] [“ content “] [$ elem [” name“]],$ elem [” content“])); } else { $this->tree[0]["content"][$elem["name"]] = array($this->tree[0]["content"][$elem["name"]],$elem["content"]); } else {$ this-> tree [0] [“ content”] [$ elem [“ name”]] = array($ this-> tree [0] [“ content”] [$ elem [“ name”]] ,$ elem [“ content”])); } } else { if (in_array($elem["name"],$this->force_to_array)) { $this->tree[0]["content"][$elem["name"]] = array($elem["content"]); }} else {if(in_array($ elem [“ name”],$ this-> force_to_array)){$ this-> tree [0] [“ content”] [$ elem [“ name”]] = array($ elem [“ content”]); } else { if (!isset($elem["content"])) $elem["content"] = ""; } else {if(!isset($ elem [“ content”]))$ elem [“ content”] =“”; $this->tree[0]["content"][$elem["name"]] = $elem["content"]; $ this-> tree [0] [“ content”] [$ elem [“ name”]] = $ elem [“ content”]; } } } } function char_data($parser, $data) { # don't add a string to non-string data if (!is_string($this->tree[0]["content"]) && !preg_match("/\\S/", $data)) return; }}}}函数char_data($ parser,$ data){#不要在非字符串数据中添加字符串,如果(!is_string($ this-> tree [0] [“ content”])&&!preg_match(“ / \\ S /“,$ data))返回; $this->tree[0]["content"] .= $data; $ this-> tree [0] [“ content”]。= $ data; } } }}

However other pages of my site are working perfect. 但是,我网站的其他页面运行良好。 You can take a look by visiting this page http://144.130.57.197/MonashHealthNew/beta.monashhealth.org/en/contact-us 您可以通过访问此页面http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/contact-us来看看

I would appreciate any type of help from you. 谢谢您的任何帮助。 Thanks in advance. 提前致谢。

I think xml-simple.php is the problem. 我认为xml-simple.php是问题。 If you view the source (on the homepage http://144.130.57.197/MonashHealthNew/beta.monashhealth.org/en/ ) it's start with: 如果您查看源(在主页http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/上 ),则从以下内容开始:

<?

/* xml-simple.php / * xml-simple.php

Can you change this to (in the xml-simple.php file)? 您可以将其更改为(在xml-simple.php文件中)吗?

<?php

/* xml-simple.php / * xml-simple.php

I think ' short_open_tag' is disabled in the config (php.ini) 我认为在配置(php.ini)中禁用了“ short_open_tag”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM