derickr / vld

BSD 2-Clause "Simplified" License
464 stars 87 forks source link

Show type information for arguments for each oparray #81

Closed Porlockzzz closed 1 year ago

Porlockzzz commented 1 year ago

I'm interested in PHP opcode, when I use VLD to analyze a case, I found some interesting. Below is the code for this case, these are two PHP files: main.php and include.php

image

image

Absolutely, after main.php execution, we get a different value for $var1 and $var2. But, when I check the opcode, I found that the opcodes for function sendref and function sendnoref are the same.

image

And for main.php, it seems that the opcode for the function call is the same too.

image

So, I want to know why we get a different value for $var1 and $var2 when the opcodes are the same.

jvoisin commented 1 year ago

Please don't use screenshots for text when possible, it's not cool for a lot of people (blind users, terminal users, …)

derickr commented 1 year ago

There is no bug here.

The "referenceness" is not checked/done through the opcode, but instead this is part of the function signature. An op array contains for each argument "arg_info_flags" which contains which type the argument is supposed to be, and also whether it is a reference or a variadic.

VLD does not show this information to go with each function (oparray) yet.

Porlockzzz commented 1 year ago

Please don't use screenshots for text when possible, it's not cool for a lot of people (blind users, terminal users, …)

Thanks for the reminder!

Porlockzzz commented 1 year ago

There is no bug here.

The "referenceness" is not checked/done through the opcode, but instead this is part of the function signature. An op array contains for each argument "arg_info_flags" which contains which type the argument is supposed to be, and also whether it is a reference or a variadic.

VLD does not show this information to go with each function (oparray) yet.

Thanks!