Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser fails on utf8 chars #56

Closed
Izopi4a opened this issue Dec 10, 2018 · 1 comment · Fixed by #65
Closed

parser fails on utf8 chars #56

Izopi4a opened this issue Dec 10, 2018 · 1 comment · Fixed by #65

Comments

@Izopi4a
Copy link

Izopi4a commented Dec 10, 2018

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
@Izopi4a Izopi4a changed the title current development branch breaks on utf8 chars parser fails on utf8 chars Feb 16, 2019
sergeyklay added a commit that referenced this issue Apr 21, 2019
@sergeyklay
Copy link
Contributor

Fixed in the development branch. Feel free to open a new issue if the problem appears again. Thank you for contributing!

sergeyklay added a commit that referenced this issue Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants