浏览代码

- php : fix in Xml error handling

Franco Ponticelli 15 年之前
父节点
当前提交
c905db911a
共有 2 个文件被更改,包括 11 次插入9 次删除
  1. 3 1
      doc/CHANGES.txt
  2. 8 8
      std/php/PhpXml__.hx

+ 3 - 1
doc/CHANGES.txt

@@ -32,7 +32,9 @@
 	neko : improved speed of Xml.toString()
 	neko : improved speed of Xml.toString()
 	all : added -D dump (for debugging purposes)
 	all : added -D dump (for debugging purposes)
 	neko : added neko.Web.isTora
 	neko : added neko.Web.isTora
-	php: added php.db.PDO (php.db.Sqlite is now deprecated)
+	php : added php.db.PDO (php.db.Sqlite is now deprecated)
+	php : fixed bug in Type.getClassFields() that reported duplicated entries
+	php : fixed errror in XML error reporting
 
 
 2009-07-26: 2.04
 2009-07-26: 2.04
 	flash9 : fixed get_full_path error with -D fdb
 	flash9 : fixed get_full_path error with -D fdb

+ 8 - 8
std/php/PhpXml__.hx

@@ -60,10 +60,11 @@ class PhpXml__ {
 
 
 	private static function __character_data_handler(parser : Dynamic, data : String) {
 	private static function __character_data_handler(parser : Dynamic, data : String) {
 		// TODO: this function can probably be simplified
 		// TODO: this function can probably be simplified
-		var lc : PhpXml__ = (build._children == null || build._children.length == 0) ? null : build._children[build._children.length-1];
-		if(lc != null && Xml.PCData == lc.nodeType) {
-			lc.nodeValue = lc.nodeValue + untyped __call__("htmlentities", data);
-		} else if((untyped __call__("strlen", data) == 1 && __call__("htmlentities", data) != data) || untyped __call__("htmlentities", data) == data) {
+//		var lc : PhpXml__ = (build._children == null || build._children.length == 0) ? null : build._children[build._children.length-1];
+//		if(lc != null && Xml.PCData == lc.nodeType) {
+//			lc.nodeValue = lc.nodeValue + untyped __call__("htmlentities", data);
+//		} else
+		if((untyped __call__("strlen", data) == 1 && __call__("htmlentities", data) != data) || untyped __call__("htmlentities", data) == data) {
 			build.addChild(createPCData(untyped __call__("htmlentities", data)));
 			build.addChild(createPCData(untyped __call__("htmlentities", data)));
 		} else
 		} else
 			build.addChild(createCData(data));
 			build.addChild(createCData(data));
@@ -89,8 +90,8 @@ class PhpXml__ {
 		if(!isComplete)
 		if(!isComplete)
 			str = "<doc>"+str+"</doc>";
 			str = "<doc>"+str+"</doc>";
 
 
-		if(untyped __call__("xml_parse", xml_parser, str, true) != 1) {
-			throw "Xml parse error ("+untyped __call__("xml_error_string", xml_parser) + ") line #" + __call__("xml_get_current_line_number", xml_parser);
+		if(1 != untyped __call__("xml_parse", xml_parser, str, true)) {
+			throw "Xml parse error ("+untyped __call__("xml_error_string", __call__("xml_get_error_code", xml_parser)) + ") line #" + __call__("xml_get_current_line_number", xml_parser);
 		}
 		}
 
 
 		untyped __call__("xml_parser_free", xml_parser);
 		untyped __call__("xml_parser_free", xml_parser);
@@ -106,8 +107,7 @@ class PhpXml__ {
 		}
 		}
 	}
 	}
 
 
-	private function new(){
-	}
+	private function new();
 
 
 	public static function createElement( name : String ) : PhpXml__ {
 	public static function createElement( name : String ) : PhpXml__ {
 		var r = new PhpXml__();
 		var r = new PhpXml__();