Closed rick2600 closed 5 years ago
Thanks for your issue @rick2600. We will address this as soon as possible
Hi @rick2600. The part "//*[@role='Variable']*//Name"
had an spare asterisk *
. I suggest you use this query instead for your purpose, please:
import bblfsh
client = bblfsh.BblfshClient("localhost:9432")
ctx = client.parse("poc.php")
ctx.filter("//*[@role='Variable']//Name")
Certainly we should find user-friendlier ways to tell that the written query is not syntactically correct :wink: If you want to extract all the variable names used, you can do so further iterating over the result of the filter
:
import bblfsh
client = bblfsh.BblfshClient("localhost:9432")
ctx = client.parse("poc.php")
it = ctx.filter("//*[@role='Variable']//Name")
for name in it:
print(name)
With respect to the awful panic failure, we will further investigate it, because the Python interpreter should not die after executing that.
Here's a reproducible example (using a file from AWS sdk):
curl https://raw.githubusercontent.com/aws/aws-sdk-php/master/src/Handler/GuzzleV5/PsrStream.php -o file.php
import bblfsh
client = bblfsh.BblfshClient("localhost:9432")
ctx = client.parse("./file.php")
ctx.filter("//*[@role='Variable']*//Name")
Hi @ncordon thank you. Yes, the problem is caused by this asterix, the query is not correct but I decided to report because of this SIGSEGV.
I found by accident an invalid memory access.
poc.py
poc.php Any php code apparently
stacktrace