浏览代码

[php] fix mb_ polyfills for default encoding

Alexander Kuzmenko 7 年之前
父节点
当前提交
4a102e1909
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      std/php/_polyfills.php

+ 2 - 2
std/php/_polyfills.php

@@ -12,7 +12,7 @@ namespace { //Namespace declaration is required because this file is included un
 	 */
 	if(!function_exists('mb_chr')) {
 		function mb_chr($code, $encoding = null) {
-			if($encoding !== 'UTF-8') {
+			if($encoding && $encoding !== 'UTF-8') {
 				throw new Exception("$encoding is not supported in mb_chr() polyfill.");
 			}
 			if (0x80 > $code %= 0x200000) {
@@ -33,7 +33,7 @@ namespace { //Namespace declaration is required because this file is included un
 	 */
 	if(!function_exists('mb_ord')) {
 		function mb_ord($s, $encoding = null) {
-			if($encoding !== 'UTF-8') {
+			if($encoding && $encoding !== 'UTF-8') {
 				throw new Exception("$encoding is not supported in mb_ord() polyfill.");
 			}
 			$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;