Skip to content

parser fails on utf8 chars #56

@Izopi4a

Description

@Izopi4a

cat test.php

<?php
$filePath = __DIR__ . '/file.zep';
$content = file_get_contents($filePath);
$a = \zephir_parse_file($content, $filePath);

var_dump($a);

cat file.zep

namespace Test;
class test {
    public function testUTF8() {
	return "dfsfsdf";
    }
}

php test.php

array(2) {
  [0]=>
  array(5) {
    ["type"]=>
    string(9) "namespace"
    ["name"]=>
    string(4) "Test"
    ["file"]=>
    string(28) "/home/izopi4a/tests/file.zep"
    ["line"]=>
    int(3)
    ["char"]=>
    int(5)
  }
  [1]=>
  array(8) {
    ["type"]=>
    string(5) "class"
    ["name"]=>
    string(4) "test"
    ["abstract"]=>
    int(0)
.......

which is expected behavior, but when I add utf8 chars in the file ...

cat file.zep

namespace Test;

class test {

    public function testUTF8() {
	return "сдфггхх";
    }
}

php test.php

    array(5) {
        ["type"]=>
        string(5) "error"
        ["message"]=>
        string(42) "Scanner error: -2 сдфггхх";
            }
        }"
    ["file"]=>
        string(28) "/home/izopi4a/tests/file.zep"
        ["line"]=>
        int(6)
        ["char"]=>
        int(8)
    }

Environment (please complete the following information):

  • OS: ubuntu 18.04
  • Zephir Parser version - 1.2.0
  • Installation type: pphize && ./configure && make -j64 && make install
  • Compiler version: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  • PHP version ubuntu's 7.2.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions