Skip to content

Use retrun value of zephir_parse_file() trigger a signal 11: SIGSEGV #47

Open
@heyuuu

Description

@heyuuu

Describe the bug
The process interrupted by signal 11: SIGSEGV when do same logic in return val of zephir_parse_file twice.

To Reproduce
Run this code:

function once()
{
    $code = "class Translate {}";
    $ast  = zephir_parse_file($code, '/test_filename.zep');

    try {
        $node = $ast[0];

        unset($node['type']);
        unset($node['file']);
        unset($node['line']);
        unset($node['char']);

        throw new \Exception();
    } catch (\Exception $e) {
    }
}

once();
once(); // It trigger error in second times

Expected behavior
Don't trgger error.

Environment (please complete the following information):

  • OS: MacOS 10.14
  • Zephir Parser version: development(b8e3162)
  • Installation type: compiling from source
  • Compiler version [e.g. gcc 5.4.0]: Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  • PHP version [e.g. 7.2.4 ( NTS )]: 7.0.30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions