Pārlūkot izejas kodu

minor php issues

Franco Ponticelli 13 gadi atpakaļ
vecāks
revīzija
17da50a60c
2 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 4 1
      std/php/Boot.hx
  2. 1 1
      std/php/_std/Std.hx

+ 4 - 1
std/php/Boot.hx

@@ -523,7 +523,10 @@ function _hx_string_rec($o, $s) {
 			}
 			return $b;
 		} else {
-			if($o instanceof _hx_anonymous) {
+			if ($o instanceof _hx_anonymous) {
+				if ($o->toString && is_callable($o->toString)) {
+					return call_user_func($o->toString);
+				}
 				$rfl = new ReflectionObject($o);
 				$b2 = \"{\n\";
 				$s .= \"\t\";

+ 1 - 1
std/php/_std/Std.hx

@@ -40,7 +40,7 @@
 	public static function parseInt( x : String ) : Null<Int> {
 		untyped if (!__call__("is_numeric", x)) {
 			var matches = null;
-			__call__('preg_match', '/\\d+/', x, matches);
+			__call__('preg_match', '/^-?\\d+/', x, matches);
 			return __call__("count", matches) == 0 ? null : __call__('intval', matches[0]);
 		} else
 			return x.substr(0, 2).toLowerCase() == "0x" ? __php__("(int) hexdec(substr($x, 2))") : __php__("intval($x)");