2
0
Эх сурвалжийг харах

[php] added "object" to keywords list (fixes #6838)

Alexander Kuzmenko 7 жил өмнө
parent
commit
0255ade5e0

+ 1 - 0
extra/CHANGES.txt

@@ -22,6 +22,7 @@
 	php : added `php.Syntax.code()` instead of deprecated `untyped __php__()` (#6708)
 	php : added methods to `php.Syntax` for each php operator: `??`, `?:`, `**` etc. (#6708)
 	php : fixed multiple file uploads in php.Web.parseMultiPart() (#4173)
+	php : fixed an issue with "Object" used as a class name for PHP 7.2 (it's a new keyword in php) (#6838)
 	python : add ssl support for http requests
 	python : improve Sys.print(ln) code generation (#6184)
 	js : generate faster code for `x.iterator()` calls (#6669)

+ 1 - 1
src/generators/genphp7.ml

@@ -140,7 +140,7 @@ let is_keyword str =
 		| "print" | "private" | "protected" | "public" | "require" | "require_once" | "return" | "static" | "switch"
 		| "throw" | "trait" | "try" | "unset" | "use" | "var" | "while" | "xor" | "yield" | "__class__" | "__dir__"
 		| "__file__" | "__function__" | "__line__" | "__method__" | "__trait__" | "__namespace__" | "int" | "float"
-		| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable"
+		| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable" | "object"
 			-> true
 		| _ -> false
 

+ 1 - 1
std/php/Boot.hx

@@ -245,7 +245,7 @@ class Boot {
 					| "print" | "private" | "protected" | "public" | "require" | "require_once" | "return" | "static" | "switch"
 					| "throw" | "trait" | "try" | "unset" | "use" | "var" | "while" | "xor" | "yield" | "__class__" | "__dir__"
 					| "__file__" | "__function__" | "__line__" | "__method__" | "__trait__" | "__namespace__" | "int" | "float"
-					| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable":
+					| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable" | "object":
 						part += '_hx';
 				case _:
 			}

+ 12 - 0
tests/unit/src/unit/issues/Issue6838.hx

@@ -0,0 +1,12 @@
+package unit.issues;
+
+class Issue6838 extends unit.Test {
+	function test() {
+		var o = new Object();
+		eq('unit.issues._Issue6838.Object', Type.getClassName(Type.getClass(o)));
+	}
+}
+
+private class Object {
+	public function new() {}
+}