Created
March 16, 2016 10:13
-
-
Save feyyazesat/87751632614f7bd86131 to your computer and use it in GitHub Desktop.
PHP EXT_STMT opcode training.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. input -> empty file | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
2 0 E > > RETURN 1 | |
2. input -> '<?php' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
2 0 E > > RETURN 1 | |
3. input -> '<?php ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
2 0 E > EXT_STMT | |
1 > RETURN 1 | |
4. input -> '<?php $test = null; ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
1 0 E > EXT_STMT | |
1 ASSIGN !0, null | |
2 2 EXT_STMT | |
3 > RETURN 1 | |
5. input -> '<?php foreach([1, 2, 3] as $it) $test = null; ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
1 0 E > EXT_STMT | |
1 INIT_ARRAY ~0 1 | |
2 ADD_ARRAY_ELEMENT ~0 2 | |
3 ADD_ARRAY_ELEMENT ~0 3 | |
4 > FE_RESET $1 ~0, ->10 | |
5 > > FE_FETCH $2 $1, ->10 | |
6 > OP_DATA | |
7 ASSIGN !0, $2 | |
8 ASSIGN !1, null | |
9 > JMP ->5 | |
10 > SWITCH_FREE $1 | |
2 11 EXT_STMT | |
12 > RETURN 1 | |
6. input -> '<?php foreach([1, 2, 3] as $it) { $test = null; } $test2 = true; ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
1 0 E > EXT_STMT | |
1 INIT_ARRAY ~0 1 | |
2 ADD_ARRAY_ELEMENT ~0 2 | |
3 ADD_ARRAY_ELEMENT ~0 3 | |
4 > FE_RESET $1 ~0, ->11 | |
5 > > FE_FETCH $2 $1, ->11 | |
6 > OP_DATA | |
7 ASSIGN !0, $2 | |
8 EXT_STMT | |
9 ASSIGN !1, null | |
10 > JMP ->5 | |
11 > SWITCH_FREE $1 | |
12 EXT_STMT | |
13 ASSIGN !2, <bool> | |
2 14 EXT_STMT | |
15 > RETURN 1 | |
7. input -> '<?php foreach([1, 2, 3] as $it) { $test = null; } $test2 = true; function a() {} ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
1 0 E > EXT_STMT | |
1 INIT_ARRAY ~0 1 | |
2 ADD_ARRAY_ELEMENT ~0 2 | |
3 ADD_ARRAY_ELEMENT ~0 3 | |
4 > FE_RESET $1 ~0, ->11 | |
5 > > FE_FETCH $2 $1, ->11 | |
6 > OP_DATA | |
7 ASSIGN !0, $2 | |
8 EXT_STMT | |
9 ASSIGN !1, null | |
10 > JMP ->5 | |
11 > SWITCH_FREE $1 | |
12 EXT_STMT | |
13 ASSIGN !2, <bool> | |
14 EXT_STMT | |
15 NOP | |
2 16 EXT_STMT | |
17 > RETURN 1 | |
8. input -> '<?php foreach([1, 2, 3] as $it) { $test = null; } $test2 = true; class b { function a() {} } ?>' | |
line #* E I O op fetch ext return operands | |
------------------------------------------------------------------------------------- | |
1 0 E > EXT_STMT | |
1 INIT_ARRAY ~0 1 | |
2 ADD_ARRAY_ELEMENT ~0 2 | |
3 ADD_ARRAY_ELEMENT ~0 3 | |
4 > FE_RESET $1 ~0, ->11 | |
5 > > FE_FETCH $2 $1, ->11 | |
6 > OP_DATA | |
7 ASSIGN !0, $2 | |
8 EXT_STMT | |
9 ASSIGN !1, null | |
10 > JMP ->5 | |
11 > SWITCH_FREE $1 | |
12 EXT_STMT | |
13 ASSIGN !2, <bool> | |
14 EXT_STMT | |
15 NOP | |
2 16 EXT_STMT | |
17 > RETURN 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment