@@ -20,7 +20,7 @@ public function scanConstant($matches)
2020 {
2121 $ constant = trim ($ matches [0 ]);
2222 $ constPrefix = $ this ->engine ->getOption ('constPrefix ' , JsPhpize::CONST_PREFIX );
23- if (strpos ($ constant , $ constPrefix ) === 0 ) {
23+ if (mb_strpos ($ constant , $ constPrefix ) === 0 ) {
2424 throw new Exception ('Constants cannot start with ' . $ constPrefix . ', this prefix is reserved for JsPhpize ' . $ this ->exceptionInfos (), 1 );
2525 }
2626
@@ -32,8 +32,8 @@ public function scanConstant($matches)
3232
3333 if (isset ($ translate [$ constant ])) {
3434 $ constant = $ translate [$ constant ];
35- } elseif (substr ($ matches [0 ], 0 , 5 ) === 'Math. ' ) {
36- $ constant = 'M_ ' . substr ($ constant , 5 );
35+ } elseif (mb_substr ($ matches [0 ], 0 , 5 ) === 'Math. ' ) {
36+ $ constant = 'M_ ' . mb_substr ($ constant , 5 );
3737 }
3838
3939 $ this ->consume ($ matches [0 ]);
@@ -69,12 +69,12 @@ public function scanOperator($matches)
6969 public function scanVariable ($ matches )
7070 {
7171 $ varPrefix = $ this ->engine ->getOption ('varPrefix ' , JsPhpize::VAR_PREFIX );
72- if (strpos ($ matches [1 ], $ varPrefix ) === 0 ) {
72+ if (mb_strpos ($ matches [1 ], $ varPrefix ) === 0 ) {
7373 throw new Exception ('Variables cannot start with ' . $ varPrefix . ', this prefix is reserved for JsPhpize ' . $ this ->exceptionInfos (), 4 );
7474 }
7575
76- if ($ this ->engine ->getOption ('ignoreDollarVariable ' ) && substr ($ matches [0 ], 0 , 1 ) === '$ ' ) {
77- $ matches [0 ] = ' ' . substr ($ matches [0 ], 1 );
76+ if ($ this ->engine ->getOption ('ignoreDollarVariable ' ) && mb_substr ($ matches [0 ], 0 , 1 ) === '$ ' ) {
77+ $ matches [0 ] = ' ' . mb_substr ($ matches [0 ], 1 );
7878 }
7979
8080 return $ this ->valueToken ('variable ' , $ matches );
0 commit comments