├── README.md ├── zend_op_array.md └── zend_op_array_en.html /README.md: -------------------------------------------------------------------------------- 1 | # PHP_Opcode_Document 2 | 如果您觉得这个项目对您有帮助,请给我一个star! 3 | 感谢! 4 | 5 | If you think this project is helpful to you,please give me a star! 6 | Thanks! 7 | 8 | 这个项目是干什么的? What this project for? 9 | --- 10 | 这个项目的目的是为了完善PHP的一个扩展"Vld"官方给出的关于PHP操作码的文档. 11 | 因为Vld所给的PHP操作码文档有很多空白部分,以及有很多不正确的地方,所以我认为有修改的必要,以备不时之需. 12 | 13 | This project is for improving PHP-Opcode document that written by VLD. 14 | Cause the PHP-Opcode doc provided by VLD still have a lot blank,even have a lot not correct place,so I think it's necessary to modify this doc. 15 | 16 | 还有,值得一提的是: 17 | 文档的例子部分我是用phpdbg输出的操作码格式表达的. 18 | 19 | 为什么我用英文写这个文档? 20 | --- 21 | 因为vld提供的文档没有中文,这意味着如果要用中文修改这个文档就必须从头到尾给每个已经有详细内容的操作码一个个用中文翻译一遍, 22 | 23 | 显然这工作量太大了,所以我更倾向于用英文修改这个文档,也就是说我仅需要将不妥的地方重新用英文翻译,并将一些原文档待补充的空白处用英文表达一遍. 24 | 25 | 文档截图 26 | --- 27 | 28 | ![截图1](https://user-images.githubusercontent.com/89259981/150990492-996f2c0c-0f79-46f4-aa27-6fbdc8c54402.png) 29 | 30 | 31 | ![截图2](https://user-images.githubusercontent.com/89259981/150990754-34746e98-fddf-4a8f-9183-4df67fffab1c.png) 32 | -------------------------------------------------------------------------------- /zend_op_array.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Zend_Op_Array

4 |

Modify by:MG193.7 5 |

My Blog 6 |

My Github 7 |

Base on vld document 8 |

9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 64 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 74 | 75 | 76 | 77 | 79 | 80 | 81 | 82 | 84 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | 94 | 95 | 96 | 97 | 99 | 100 | 101 | 102 | 104 | 105 | 106 | 107 | 109 | 110 | 111 | 112 | 114 | 115 | 116 | 117 | 119 | 120 | 121 | 122 | 124 | 125 | 126 | 127 | 129 | 130 | 131 | 132 | 140 | 141 | 142 | 143 | 145 | 146 | 147 | 148 | 150 | 151 | 152 | 153 | 155 | 156 | 157 | 158 | 160 | 161 | 162 | 163 | 165 | 166 | 167 | 168 | 170 | 171 | 172 | 173 | 175 | 176 | 177 | 178 | 180 | 181 | 182 | 183 | 185 | 186 | 187 | 188 | 190 | 191 | 192 | 193 | 195 | 196 | 197 | 198 | 200 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 210 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 220 | 221 | 222 | 224 | 225 | 226 | 227 | 228 | 230 | 231 | 232 | 233 | 237 | 238 | 239 | 240 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 259 | 260 | 261 | 262 | 264 | 265 | 266 | 267 | 272 | 273 | 274 | 275 | 280 | 281 | 282 | 283 | 285 | 286 | 287 | 288 | 291 | 292 | 293 | 295 | 301 | 302 | 303 | 307 | 308 | 309 | 310 | 311 | 316 | 317 | 318 | 320 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 341 | 342 | 343 | 344 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 362 | 363 | 364 | 365 | 369 | 370 | 371 | 372 | 376 | 377 | 378 | 380 | 381 | 382 | 383 | 384 | 386 | 387 | 388 | 389 | 391 | 392 | 393 | 394 | 397 | 398 | 399 | 401 | 404 | 405 | 406 | 407 | 412 | 413 | 414 | 415 | 420 | 421 | 422 | 423 | 428 | 429 | 430 | 431 | 436 | 437 | 438 | 439 | 443 | 444 | 445 | 446 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 465 | 466 | 467 | 468 | 470 | 471 | 472 | 473 | 477 | 478 | 479 | 480 | 482 | 483 | 484 | 485 | 489 | 490 | 491 | 492 | 494 | 495 | 496 | 497 | 499 | 500 | 501 | 502 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 520 | 521 | 522 | 523 | 528 | 529 | 530 | 531 | 537 | 538 | 539 | 540 | 545 | 546 | 547 | 548 | 555 | 556 | 557 | 558 | 562 | 563 | 564 | 565 | 569 | 570 | 571 | 572 | 575 | 576 | 577 | 578 | 581 | 582 | 583 | 584 | 587 | 588 | 589 | 590 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 610 | 611 | 612 | 613 | 619 | 620 | 621 | 622 | 628 | 629 | 630 | 631 | 634 | 635 | 636 | 637 | 640 | 641 | 642 | 643 | 646 | 647 | 648 | 649 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 665 | 666 | 667 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 706 | 707 | 708 | 709 | 711 | 712 | 713 | 714 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 727 | 728 | 729 | 730 | 734 | 735 | 736 | 737 | 741 | 742 | 743 | 744 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 756 | 757 | 758 | 759 | 763 | 764 | 765 | 766 | 768 | 769 | 770 | 771 | 773 | 774 | 775 | 776 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 856 | 857 | 858 | 859 | 861 | 862 | 863 | 864 | 867 | 868 | 869 | 870 | 872 | 873 | 874 | 875 | 878 | 879 | 880 | 881 | 885 | 886 | 887 | 888 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 902 | 903 | 904 | 905 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 953 | 954 | 955 | 956 | 960 | 961 | 962 | 963 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 |
Opcode nameExplanationExample (phpdbg)
NOPno operationNOP
ADDAdds "value1" to "value2" and stores the result into "result".ADD 1 2 ~0
25 | $a = 1+2;
SUBSubtracts "value2" from "value1" and stores the result into "result".SUB 2 1 ~0
31 | $a = 2-1;
MULMultiplys "value1" by "value2" and stores the result into "result".MUL 1 2 ~0
37 | $a = 1*2;
DIVDivides "value1" by "value2" and stores the result into "result".DIV 6 3 ~0
43 | $a = 6/3;
MODMakes the value of "result" congruent to "value1" modulo "value2".MOD 6 3 ~0
48 | $a = 6%3;
SLShift bits of value1 to the left value2 steps (each step means "multiply by two")SL 8 2 ~0
53 | $a = 8<<2;
SRShift bits of value1 to the right value2 steps (each step means "divide by two")SR 8 2 ~0
58 | $a = 8>>2;
CONCATConcats string values string1 and string2CONCAT "A" "B" ~0
63 | echo "A"."B";
BW_ORBit-wise or of value1 and value2BW_OR 1 2 ~0
68 | echo 1|2;
BW_ANDBit-wise and of value1 and value2BW_AND 1 2 ~0
73 | echo 1&2;
BW_XORBit-wise xor of value1 and value2BW_XOR 1 2 ~0
78 | echo 1^2;
BW_NOTBit-wise not of "value"BW_NOT 15 ~0
83 | echo ~15;
BOOL_NOTBoolean (logical) not of "value"BOOL_NOT 1 ~0
88 | echo !1;
BOOL_XORBoolean (logical) xor of value1BOOL 1 2 ~0
93 | echo 1 xor 2;
IS_IDENTICALCompares value1 and value2 to see if they are equal AND have the same typeIS_IDENTICAL 1 1 ~0
98 | echo (1===1);
IS_NOT_IDENTICALcompares value1 and value2 to see if they are unequal or of different typesIS_NOT_IDENTICAL 1 1 ~0
103 | echo (1!==1);
IS_EQUALcompares if value1 and value2 are equalIS_EQUAL 1 1 ~0
108 | echo (1==1);
IS_NOT_EQUALcompares if value1 and value2 are not equalIS_NOT_EQUAL 1 1 ~0
113 | echo (1!=1);
IS_SMALLERcompares if value1 is less than value2IS_SMALLER1 1 2 ~0
118 | echo (1 < 2);
IS_SMALLER_OR_EQUALcompares if value1 is less than or equal to value2IS_SMALLER_OR_EQUAL 2 1 ~0
123 | echo (2<=1);
CASTcasts value1 as type value2 (type in extended_value)CAST<4> 1 ~0
128 | echo (int)1;
QM_ASSIGNQuestion Mark Assign, used twice inside a question mark assign to temporarily assign result as value1 (this is followed up with an ASSIGN bytecode) 133 | JMPZ 1 J3
134 | QM_ASSIGN 1 ~0
135 | JMP J4
136 | QM_ASSIGN 2 ~0
137 | ECHO ~0
138 | echo (1?1:2); 139 |
ASSIGN_ADDAdd value1 to value2 and store in variable indicated by value1ASSIGN_ADD $a 2
144 | $a+=2;
ASSIGN_SUBSubtract value1 from value2 and store in variable indicated by value1ASSIGN_SUB $a 2
149 | $a-=2;
ASSIGN_MULMultiply result by value1 and store in variable indicated by resultASSIGN_MUL $a 2
154 | $a*=2;
ASSIGN_DIVDivide result by value1and store in variable indicated by result.ASSIGN_DIV $a 2
159 | $a/=2;
ASSIGN_MODPerform result mod value1 and store in variable indicated by resultASSIGN_MOD $a 2
164 | $a%=2;
ASSIGN_SLShift result by value1 bits to left and store in variable indicated by resultASSIGN_SL $a 2
169 | $a<<=2;
ASSIGN_SRShift result by value1 bits to right and store in variable indicated by resultASSIGN_SR $a 2
174 | $a>>=2;
ASSIGN_CONCATConcats string values result and value1 and store in variable indicated by resultASSIGN_CONCAT $a 'z'
179 | $a.='z';
ASSIGN_BW_ORPerforms binary OR on result and value1 and stores in variable indicated by result.ASSIGN_BW_OR $a 64
184 | $a|=64;
ASSIGN_BW_ANDPerforms binary AND on result and value1 and stores in variable indicated by result.ASSIGN_BW_AND $a 64
189 | $a &=64;
ASSIGN_BW_XORPerforms binary XOR on result and value1and stores in variable indicated by result.ASSIGN_BW_XOR $a 64
194 | $a ^=64;
PRE_INCincrements variable indicated by value1 by 1 (before performing other operations) and stores in resultPRE_INC $a
199 | ++$a;
PRE_DECdecrements variable indicated by value1 by 1 (before performing other operations) and stores in resultsPRE_DEC $a
204 | --$a;
POST_INCincrements variable indicated by value1 by 1 (after performing other operations) and stores in resultPOST_INC $a ~0
209 | $a++;
POST_DECdecrements variable indicated by value1 by 1 (after performing other operations) and stores in resultPOST_DEC $a ~0
214 | $a--;
ASSIGNassigns value1 to resultASSIGN $a $b
219 | $a=$b;
ASSIGN_REFUNKNOW in phpdbg.
223 | Maybe you could refer to ASSIGN_REF
UNKNOW
ECHODump textECHO "hello world"
229 | echo "hello world";
PRINTSame as ECHO?ECHO<1> "hello world"
234 | print 'hello world';
235 | If you want to refer the opcodes in vld,
you could see PRINT 236 |
JMPUnconditonally jump to the address#0 IS_EQUAL $a "a" ~0
241 | #1 JMPZ ~0 J4
242 | #2 ECHO 1
243 | #3 JMP J5
244 | #4 ECHO 2
245 | #5 RETURN<-1> 1

246 | if($a=="a"){echo 1;}else{echo 2;}
JMPZJump to the address if the value is zeroYou could see the opcodes in JMP
JMPNZJump to the address if the value is not zero...
255 | JMPNZ ~0 JX
256 | ...

257 | if($b!=0){...} 258 |
JMPZNZJump to the address given in the operands if the value is zero;
jump to the address given in extended data if nonzero.
UNKNOW in phpdbg
263 | You could refer to JMPZNZ
JMPZ_EXJump to the address if the value is zero.#0 JMPZ_EX $a J2 ~0
268 | #1 BOOL true ~0
269 | #2 JMPZ ~0
270 | #3 RETURN<-1> 1

271 | if($a&&true){}
JMPNZ_EXJump to the address if the value is not zero.#0 JMPZ_EX $a J2 ~0
276 | #1 BOOL true ~0
277 | #2 JMPZ ~0
278 | #3 RETURN<-1> 1

279 | if($a||true){}
CASEUNKNOWDo not found CASE opcode in phpdbg,
284 | You could refer to CASE
SWITCH_FREERelease the allocated space of "value"?Do not found SWITCH_FREE in phpdbg,
289 | You could refer to SWITCH_FREE 290 |
BRKIt means "break" in vld,
But not found this opcode in phpdbg.
294 | If you want to break in while-loop(or something else),phpdbg will simply use JMP opcode jump out the loop,instead of use "BRK" opcode.
#0 JMP J2
296 | #1 JMP J3
297 | #2 JMPNZ 1 J1
298 | #3 RETURN<-1> 1

299 | while(1){break;}
300 | You also could see BRK
CONTSame as BRK opcode,
304 | this opcode means "continue" in vld,
305 | But not found this opcode in phpdbg.
306 | phpdbg still use JMP to control the flow in loop.
You could refer to CONT
BOOLconvert value to boolean and store in result#0 JMPZ_EX $a J2 ~0
312 | #1 BOOL true ~0
313 | #2 JMPZ ~0
314 | #3 RETURN<-1> 1

315 | if($a&&true){}
ROPE_INITwhen create a string that cotains variable,
319 | this opcode used to init this string and store the string of begining part to result
ROPE_INIT<3> "Test" ~1
321 | ROPE_ADD<1> ~1 $a ~1
322 | ROPE_END<2> ~1 " Test" ~0
323 | ECHO ~0

324 | echo "Test$a Test";
ROPE_ADDafter ROPE_INIT opcode,continue add a variable to string,and store the string to result.Could see ROPE_INIT part
ROPE_ENDafter ROPE_INIT opcode,continue add a string to the whole string,and treat the string just added as the end of the whole string.Could see ROPE_INIT part
FAST_CONCATconcats value1 and value2,than stored it to the result 337 | FAST_CONCAT "Test" $a ~0
338 | ECHO ~0

339 | echo "Test$a"; 340 |
BEGIN_SILENCEprepare to perform function call without displaying error messagesBEGIN_SILENCE ~0
345 | INIT_FCALL<1> 96 "file"
SEND_VAL"non_existent_file" 1
346 | DO_ICALL @1
347 | END_SILENCE ~0
348 | ASSIGN $a @1
349 | RETURN<-1> 1

350 | $a = @file("non_existent_file");
END_SILENCEno longer surpress error messagesSee BEGIN_SILENCE part
INIT_FCALLinit a function going to callINIT_FCALL<1> 96 "abs"
359 | SEND_VAL 2 1
360 | DO_ICALL

361 | abs(2);
INIT_DYNAMIC_CALLcall to function dynamiclyASSIGN $x "phpinfo"
366 | INIT_DYNAMIC_CALL $x
367 | DO_FCALL

368 | $x = 'phpinfo';
$x();
INIT_FCALL_BY_NAMEcall to functionINIT_FCALL_BY_NAME "test"
373 | DO_FCALL @1
374 | ASSIGN $a @1

375 | $a = test();
DO_FCALLCall a function.
379 | If the result of called function was stored to a variable,this opcode must take a result!
See INIT_DYNAMIC_CALL and INIT_FCALL_BY_NAME part
DO_FCALL_BY_NAMECall a function by name.UNKNOW in phpdbg,
385 | You could see DO_FCALL_BY_NAME
RETURNReturn value from a funciton.RETURN 1
390 | return 1;
RECVReceive the number of functoin argumentsRECV 1 $a
395 | RETURN<-1> null

396 | function test($a){}
RECV_INITInitialize a function argument with "value" if not received from caller.
400 | Otherwise same as RECV.
RECV_INIT 1 "test" $t
402 | RETURN<-1> null

403 | function a($t="test"){}
SEND_VALPass the constant value as an actual parameter to a function.INIT_FCALL<2> 112 "hello"
408 | SEND_VAL "world" 1
409 | SEND_VAL "ok" 2
410 | DO_FCALL

411 | hello("world","ok");
SEND_VAL_EXPass the constant value as an actual parameter to a function.Same as SEND_VAL_EXINIT_FCALL_BY_NAME<2> "hello"
416 | SEND_VAL_EX "world" 1
417 | SEND_VAL_EX "ok" 2
418 | DO_FCALL

419 | hello("world","ok");
SEND_VARPass the variable value as an actual parameter to a function.ASSIGN $a 1
424 | INIT_FCALL<1> 96 "abs"
425 | SEND_VAR $a 1
426 | DO_ICALL

427 | $a=1;abs($a);
SEND_VAR_EXPass the variable value as an actual parameter to a function.Same as SEND_VAR.ASSIGN $a 1
432 | INIT_FCALL_BY_NAME<1> "test"
433 | SEND_VAR_EX $a 1
434 | DO_ICALL

435 | $a=1;test($a);
SEND_REFPass the reference value as an actual parameter to a function.INIT_FCALL<1> 96 "each"
440 | SEND_REF $a 1
441 | DO_ICALL

442 | @each($a);
NEWConstruct an instance of "type" and store the reference to the object into "result".NEW<2> "A" @1
447 | SEND_VAL_EX "a" 1
448 | DO_FCALL
449 | FREE @1

450 | new A("a"); 451 |
INIT_NS_FCALL_BY_NAMENo sample in vld or phpdbg.UNKNOW
FREERelease the allocated space of the value.Could see NEW part
INIT_ARRAYAllocate a new array with elem-value as the first element of the array.UNKNOW in phpdbg,
464 | You could refer to INIT_ARRAY
ADD_ARRAY_ELEMENTAdd elem-value as an element to array-valueUNKNOW in phpdbg,
469 | You could refer to ADD_ARRAY_ELEMENT
INCLUDE_OR_EVALInclude the file specified by filename and eval it.INCLUDE_OR_EVAL<2> "test.php"
474 | INCLUDE_OR_EVAL<1> "echo 1;"

475 | include "test.php";
476 | eval("echo 1;");
UNSET_CVUnset the variable.UNSET_CV $A
481 | unset($A);
UNSET_VARUnset the variable.ASSIGN $A "x"
486 | UNSET_VAR<4> $A

487 | $A="x";
488 | unset($$A);
UNSET_DIMUnset the entry of array-value, which is specified by indexUNSET_DIM $A 0
493 | unset($A[0]);
UNSET_OBJUnset the property of the current objectUNSET_OBJ<8> $A "test"
498 | unset($A->test);
FE_RESET_RInitialize an iterator on array-value. If the array is empty, jump to address.#0 ASSIGN $a array(3)
503 | #1 FE_RESET_R $a J5 @1
504 | #2 FE_FETCH_R<96> @1 $num
505 | #3 ECHO<1> $num
506 | #4 JMP J2
507 | #5 FE_FREE @1

508 | $a = array(1,2,3);
509 | foreach($a as $num){
510 | print $num;
}
FE_FETCH_RFetch an element from iterator.
If no element is available, jump to the address that FE_RESET_R opcode setted.
Could see FE_RESET_R part.
EXITExit running after dumping "message".EXIT "foo"
519 | die("foo");
FETCH_Rfetch Variable variables.ASSIGN $a "x"
524 | FETCH_R<4> $a ~1
525 | ECHO ~1

526 | $a="x";
527 | echo $$a;
FETCH_DIM_Rfetch value of variables by index.FETCH_R<4> $a ~1
532 | FETCH_DIM_R ~1 0 ~2
533 | ECHO ~2

534 | echo $$a[0];

535 | FETCH_DIM_R $x 0
536 | $x[0];
FETCH_OBJ_Rfetch property value of Variable variablesFETCH_R<4> $a ~1
541 | FETCH_OBJ_R ~1 "test" ~2
542 | ECHO ~2

543 | echo($$a->test); 544 |
FETCH_Wfetch Variable variables and make it writable.ASSIGN $x 1
549 | ASSIGN $a "x"
550 | FETCH_W<4> $a @2
551 | ASSIGN @2 2

552 | $x=1;
553 | $a="x";
554 | $$a=2;
FETCH_DIM_Wfetch Variable variables by index and make it writable.FETCH_DIM_W $x 0 @0
559 | ASSIGN_DIM @0 1
560 | OP_DATA 2

561 | $x[0][1]=2;
FETCH_OBJ_Wfetch property value of Variable variables and make it writable.FETCH_OBJ_W $x "t" @0
566 | ASSIGN_OBJ<16> @0 "test"
567 | OP_DATA 1

568 | $x->t->test=1;
FETCH_RWfetch value of Variable variables.FETCH_RW<4> $a @0
573 | POST_INC @0;

574 | $$a++;
FETCH_DIM_RWfetch value of Variable variables by index.FETCH_DIM_RW $a 0 @0
579 | POST_INC @0

580 | $a[0]++;
FETCH_OBJ_RWfetch property value of Variable variablesFETCH_OBJ_RW $a "b" @0
585 | POST_INC_OBJ<16> @0 "c"

586 | $a->b->c++;
FETCH_ISFetch the value from variable which is to be used to test if it is set or not, through isset()/isempty().FETCH_IS<2> "_GET" ~0
591 | ISSET_ISEMPTY_DIM_OBJ ~0 0

592 | isset($_GET[0]);
FETCH_DIM_ISNo php sample.
FETCH_OBJ_ISNo php sample.
FETCH_FUNC_ARGfetch value of Variable variables as arg of functionINIT_FCALL_BY_NAME<1> "test"
605 | CHECK_FUNC_ARG 1
606 | FETCH_FUNC_ARG<4> $a @0
607 | SEND_FUNC_ARG @0 1
608 | DO_FCALL

609 | test($$a);
FETCH_DIM_FUNC_ARGfetch value of variable by index as arg of functionINIT_FCALL_BY_NAME<1> "test"
614 | CHECK_FUNC_ARG 1
615 | FETCH_DIM_FUNC_ARG $a 0 @0
616 | SEND_FUNC_ARG @0 1
617 | DO_FCALL

618 | test($a[0]);
FETCH_OBJ_FUNC_ARGfetch property value of variable as arg of functionINIT_FCALL_BY_NAME<1> "test"
623 | CHECK_FUNC_ARG 1
624 | FETCH_OBJ_FUNC_ARG $a "b" @0
625 | SEND_FUNC_ARG @0 1
626 | DO_FCALL

627 | test($a->b);
FETCH_UNSETFetch a variable for the purpose of unset() operation.FETCH_UNSET<4> $A @1
632 | UNSET_DIM @1 0

633 | unset($$A[0]);
FETCH_DIM_UNSETFetch a variable by index for the purpose of unset() operation.FETCH_DIM_UNSET $a 0 @0
638 | UNSET_OBJ @0 "b"

639 | unset($a[0]->b);
FETCH_OBJ_UNSETFetch a property value of variable for the purpose of unset() operation.FETCH_OBJ_UNSET $a "b" @0
644 | UNSET_OBJ<16> @0 "c"

645 | unset($a->b->c);
FETCH_LIST_RFetch array list.FETCH_LIST_R array(2) 0 @0
650 | ASSIGN $x @0
651 | FETCH_LIST_R array(2) 1 @2
652 | ASSIGN $b @2

653 | list($x,$b) = array("x","b"); 654 |
FETCH_DIM_TMP_VARNo php sample in phpdbgYou could refer to FETCH_DIM_TMP_VAR
FETCH_CONSTANTfetch value by const name.FETCH_CONSTANT "A" ~0
663 | ECHO ~0

664 | echo A;
GOTONo sample in phpdbg and vld,
668 | phpdbg use JMP opcode to control flow.
EXT_STMTNo php sample
EXT_FCALL_BEGINNo php sample
EXT_FCALL_ENDNo php sample
EXT_NOPNo php sample
TICKSTICKS<100>
690 | declare(ticks=100);
SEND_VAR_NO_REFNo php sample
CATCHcatch when Exception get throw.#0 THROW $t
699 | #1 JMP J4
700 | #2 CATCH<1> "A" $e
701 | #3 ECHO "catch"
702 | #4 RETURN<-1> 1

703 | try{throw $t}
704 | catch(A $e){echo "catch";} 705 |
THROWthrow some Exception.THROW $t
710 | throw $t;
FETCH_CLASSfetch static classFETCH_CLASS $obj @0
715 | FETCH_CLASS_CONSTANT @0 "a"

716 | $obj::a;
FETCH_CLASS_CONSTANTfetch static constant from classCould see FETCH_CLASS part.
FETCH_STATIC_PROP_Rfetch static property value from classFETCH_CLASS $obj @0
725 | FETCH_STATIC_PROP_R "a" @0 ~1

726 | $obj::$a;
FETCH_STATIC_PROP_RWfetch static property value from class,same as FETCH_STATIC_PROP_R but make it readable and writable.FETCH_CLASS $obj @0
731 | FETCH_STATIC_PROP_RW "a" @0 @1
732 | POST_INC @1 ~2

733 | $obj::$a++;
FETCH_STATIC_PROP_Wfetch static property value from class AND make it writable.FETCH_CLASS $obj @0
738 | FETCH_STATIC_PROP_W "a" @0 @1
739 | ASSIGN @1 1

740 | $obj::$a=1;
CLONEclone an objectCLONE $t ~0
745 | clone $t;
RETURN_BY_REFNo sample in phpdbg
INIT_METHOD_CALLPrepare for a method call. Followed by DO_FCALL.INIT_METHOD_CALL $obj "a"
754 | DO_FCALL

755 | $obj->a();
INIT_STATIC_METHOD_CALLPrepare for a static method call. Followed by DO_FCALL.FETCH_CLASS $obj @0
760 | INIT_STATIC_METHOD_CALL @0 "a"
761 | DO_FCALL

762 | $obj::a();
ISSET_ISEMPTY_CVcheck wether a variable is setted and store the result.ISSET_ISEMPTY_CV $a ~0
767 | isset($a);
ISSET_ISEMPTY_VARcheck wether a variable is setted and store the result.ISSET_ISEMPTY_VAR<4> $a ~0
772 | isset($$a);
ISSET_ISEMPTY_DIM_OBJcheck wether a variable is setted by its index and store the result.ISSET_ISEMPTY_DIM_OBJ $a 0 ~0
777 | isset($a[0]);
ZEND_SEND_VAL_EXCould see SEND_VAL_EX part.
ZEND_SEND_VARCould see SEND_VAR part.
ZEND_INIT_USER_CALL
ZEND_SEND_ARRAY
ZEND_SEND_USER
STRLENget length of string and store the resultSTRLEN $a
strlen($a);
DEFINED
ZEND_TYPE_CHECK
ZEND_VERIFY_RETURN_TYPE
ZEND_FE_RESET_RW
ZEND_FE_FETCH_RW
ZEND_FE_FREE
ZEND_INIT_DYNAMIC_CALL
ZEND_DO_ICALL
ZEND_DO_UCALL
ZEND_DO_FCALL_BY_NAME
PRE_INC_OBJSame as PRE_INC but operate to an objectPRE_INC_OBJ $obj "a"
846 | ++$obj->a;
PRE_DEC_OBJSame as PRE_DEC but operate to an objectPRE_DEC_OBJ $obj "a"
--$obj->a;
POST_INC_OBJSame as POST_INC but operate to an objectPOST_INC_OBJ $obj "a" ~0
855 | $obj->a++;
POST_DEC_OBJSame as POST_DEC but operate to an objectPOST_DEC_OBJ $obj "a" ~0
860 | $obj->a--;
ASSIGN_OBJfetch an object and wait for OP_DATA opcode.ASSIGN_OBJ $obj "a"
865 | OP_DATA $t

866 | $obj->a=$t;
INSTANCEOFINSTANCEOF $a "A" ~0
871 | $a instanceof A;
DECLARE_CLASSdeclare a class by nameJMPZ true JX
876 | DECLARE_CLASS "a" @0

877 | if(true){class A{}}
DECLARE_INHERITED_CLASSwhen declare a class by name,if declared class extends other class,will execute this opcode.JMPZ true JX
882 | DECLARE_INHERITED_CLASS "a" "C" @0

883 | if(true){
884 | class a extends C{}
}
DECLARE_FUNCTIONdeclare function by nameJMPZ true JX
889 | DECLARE_FUNCTION "test"

890 | if(true){
891 | function test(){}
892 | }
RAISE_ABSTRACT_ERROR
DECLARE_CONSTdeclare a const valueDECLARE_CONST "a" 1
901 | const a=1;
ADD_INTERFACEwhen declare class by name,if declared class implements other interface,will execute this opcode.JMPZ true JX
906 | DECLARE_CLASS "a" @0
907 | ADD_INTERFACE @0 "C"
908 | VERIFY_ABSTRACT_CLASS @0

909 | if(true){
910 | class a implements C{}
}
DECLARE_INHERITED_CLASS_DELAYED
VERIFY_ABSTRACT_CLASSCould see ADD_INTERFACE part.
ASSIGN_DIMset value of variable by index,followed by OP_DATA.ASSIGN_DIM $x 0
923 | OP_DATA 2

924 | $x[0]=2;
OP_DATAset value after "ASSIGN" opcodes(such as ASSIGN_DIM,ASSIGN_OBJ...) executed.Could see ASSIGN_DIM part.
ISSET_ISEMPTY_PROP_OBJcheck wether a property value of an object is setted and store the resultISSET_ISEMPTY_PROP_OBJ $a "b" ~0
933 | isset($a->b);
HANDLE_EXCEPTION
USER_OPCODE
ZEND_ASSERT_CHECK
JMP_SETset the variable if value is not zero,otherwise jump to addressJMP_SET $b JX ~0
950 | QM_ASSIGN 2 ~0
951 | ASSIGN $t ~0

952 | $t=$b?:2;
DECLARE_LAMBDA_FUNCTIONDECLARE_LAMBDA_FUNCTION "\000{clousre}C:\\"+ ~0
957 | INIT_DYNAMIC_CALL ~0
958 | DO_FCALL

959 | (function(){return "phpinfo";})();
ADD_TRAITfollowed by BIND_TRAITSDECLARE_CLASS "a" @0
964 | ADD_TRAIT @0 "B"
965 | BIND_TRAITS @0

966 | class A{
967 | use B;
968 | }
BIND_TRAITSbind trait in class.Could see ADD_TRAIT part.
ZEND_SEPARATE
ZEND_FETCH_CLASS_NAME
ZEND_CALL_TRAMPOLINE
ZEND_DISCARD_EXCEPTION
ZEND_YIELD
ZEND_GENERATOR_RETURN
ZEND_FAST_CALL
ZEND_FAST_RET
ZEND_RECV_VARIADIC
ZEND_SEND_UNPACK
ZEND_POW
ZEND_ASSIGN_POW
ZEND_BIND_GLOBAL(vld)
BIND_GLOBAL
declare an global variableBIND_GLOBAL $a "a"
1025 | global $a;
ZEND_COALESCE
ZEND_SPACESHIP
ZEND_DECLARE_ANON_CLASS
ZEND_DECLARE_ANON_INHERITED_CLASS
ZEND_FETCH_STATIC_PROP_R
ZEND_FETCH_STATIC_PROP_W
ZEND_FETCH_STATIC_PROP_RW
ZEND_FETCH_STATIC_PROP_IS
ZEND_FETCH_STATIC_PROP_FUNC_ARG
ZEND_FETCH_STATIC_PROP_UNSET
ZEND_UNSET_STATIC_PROP
ZEND_ISSET_ISEMPTY_STATIC_PROP
ZEND_FETCH_CLASS_CONSTANT
ZEND_BIND_LEXICAL
ZEND_BIND_STATIC
ZEND_FETCH_THIS
ZEND_SEND_FUNC_ARG
ZEND_ISSET_ISEMPTY_THIS
ZEND_SWITCH_LONG
ZEND_SWITCH_STRING
ZEND_IN_ARRAY
ZEND_COUNT
ZEND_GET_CLASS
ZEND_GET_CALLED_CLASS
ZEND_GET_TYPE
ZEND_FUNC_NUM_ARGS
ZEND_FUNC_GET_ARGS
ZEND_UNSET_CV
1141 | 1142 | 1143 | -------------------------------------------------------------------------------- /zend_op_array_en.html: -------------------------------------------------------------------------------- 1 | 2 | ZEND_OP_ARRAY 3 | 4 |

Zend_Op_Array

5 |

Modify by:MG193.7 6 |

My Blog 7 |

My Github 8 |

Base on vld document 9 |

10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | 70 | 71 | 72 | 73 | 75 | 76 | 77 | 78 | 80 | 81 | 82 | 83 | 85 | 86 | 87 | 88 | 90 | 91 | 92 | 93 | 95 | 96 | 97 | 98 | 100 | 101 | 102 | 103 | 105 | 106 | 107 | 108 | 110 | 111 | 112 | 113 | 115 | 116 | 117 | 118 | 120 | 121 | 122 | 123 | 125 | 126 | 127 | 128 | 130 | 131 | 132 | 133 | 141 | 142 | 143 | 144 | 146 | 147 | 148 | 149 | 151 | 152 | 153 | 154 | 156 | 157 | 158 | 159 | 161 | 162 | 163 | 164 | 166 | 167 | 168 | 169 | 171 | 172 | 173 | 174 | 176 | 177 | 178 | 179 | 181 | 182 | 183 | 184 | 186 | 187 | 188 | 189 | 191 | 192 | 193 | 194 | 196 | 197 | 198 | 199 | 201 | 202 | 203 | 204 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 214 | 216 | 217 | 218 | 219 | 221 | 222 | 223 | 225 | 226 | 227 | 228 | 229 | 231 | 232 | 233 | 234 | 238 | 239 | 240 | 241 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 260 | 261 | 262 | 263 | 265 | 266 | 267 | 268 | 273 | 274 | 275 | 276 | 281 | 282 | 283 | 284 | 286 | 287 | 288 | 289 | 292 | 293 | 294 | 296 | 302 | 303 | 304 | 308 | 309 | 310 | 311 | 312 | 317 | 318 | 319 | 321 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 342 | 343 | 344 | 345 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 363 | 364 | 365 | 366 | 370 | 371 | 372 | 373 | 377 | 378 | 379 | 381 | 382 | 383 | 384 | 385 | 387 | 388 | 389 | 390 | 392 | 393 | 394 | 395 | 398 | 399 | 400 | 402 | 405 | 406 | 407 | 408 | 413 | 414 | 415 | 416 | 421 | 422 | 423 | 424 | 429 | 430 | 431 | 432 | 437 | 438 | 439 | 440 | 444 | 445 | 446 | 447 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 466 | 467 | 468 | 469 | 471 | 472 | 473 | 474 | 478 | 479 | 480 | 481 | 483 | 484 | 485 | 486 | 490 | 491 | 492 | 493 | 495 | 496 | 497 | 498 | 500 | 501 | 502 | 503 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 521 | 522 | 523 | 524 | 529 | 530 | 531 | 532 | 538 | 539 | 540 | 541 | 546 | 547 | 548 | 549 | 556 | 557 | 558 | 559 | 563 | 564 | 565 | 566 | 570 | 571 | 572 | 573 | 576 | 577 | 578 | 579 | 582 | 583 | 584 | 585 | 588 | 589 | 590 | 591 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 611 | 612 | 613 | 614 | 620 | 621 | 622 | 623 | 629 | 630 | 631 | 632 | 635 | 636 | 637 | 638 | 641 | 642 | 643 | 644 | 647 | 648 | 649 | 650 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 666 | 667 | 668 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 707 | 708 | 709 | 710 | 712 | 713 | 714 | 715 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 728 | 729 | 730 | 731 | 735 | 736 | 737 | 738 | 742 | 743 | 744 | 745 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 757 | 758 | 759 | 760 | 764 | 765 | 766 | 767 | 769 | 770 | 771 | 772 | 774 | 775 | 776 | 777 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 857 | 858 | 859 | 860 | 862 | 863 | 864 | 865 | 868 | 869 | 870 | 871 | 873 | 874 | 875 | 876 | 879 | 880 | 881 | 882 | 886 | 887 | 888 | 889 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 903 | 904 | 905 | 906 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 954 | 955 | 956 | 957 | 961 | 962 | 963 | 964 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 |
Opcode nameExplanationExample (phpdbg)
NOPno operationNOP
ADDAdds "value1" to "value2" and stores the result into "result".ADD 1 2 ~0
26 | $a = 1+2;
SUBSubtracts "value2" from "value1" and stores the result into "result".SUB 2 1 ~0
32 | $a = 2-1;
MULMultiplys "value1" by "value2" and stores the result into "result".MUL 1 2 ~0
38 | $a = 1*2;
DIVDivides "value1" by "value2" and stores the result into "result".DIV 6 3 ~0
44 | $a = 6/3;
MODMakes the value of "result" congruent to "value1" modulo "value2".MOD 6 3 ~0
49 | $a = 6%3;
SLShift bits of value1 to the left value2 steps (each step means "multiply by two")SL 8 2 ~0
54 | $a = 8<<2;
SRShift bits of value1 to the right value2 steps (each step means "divide by two")SR 8 2 ~0
59 | $a = 8>>2;
CONCATConcats string values string1 and string2CONCAT "A" "B" ~0
64 | echo "A"."B";
BW_ORBit-wise or of value1 and value2BW_OR 1 2 ~0
69 | echo 1|2;
BW_ANDBit-wise and of value1 and value2BW_AND 1 2 ~0
74 | echo 1&2;
BW_XORBit-wise xor of value1 and value2BW_XOR 1 2 ~0
79 | echo 1^2;
BW_NOTBit-wise not of "value"BW_NOT 15 ~0
84 | echo ~15;
BOOL_NOTBoolean (logical) not of "value"BOOL_NOT 1 ~0
89 | echo !1;
BOOL_XORBoolean (logical) xor of value1BOOL 1 2 ~0
94 | echo 1 xor 2;
IS_IDENTICALCompares value1 and value2 to see if they are equal AND have the same typeIS_IDENTICAL 1 1 ~0
99 | echo (1===1);
IS_NOT_IDENTICALcompares value1 and value2 to see if they are unequal or of different typesIS_NOT_IDENTICAL 1 1 ~0
104 | echo (1!==1);
IS_EQUALcompares if value1 and value2 are equalIS_EQUAL 1 1 ~0
109 | echo (1==1);
IS_NOT_EQUALcompares if value1 and value2 are not equalIS_NOT_EQUAL 1 1 ~0
114 | echo (1!=1);
IS_SMALLERcompares if value1 is less than value2IS_SMALLER1 1 2 ~0
119 | echo (1 < 2);
IS_SMALLER_OR_EQUALcompares if value1 is less than or equal to value2IS_SMALLER_OR_EQUAL 2 1 ~0
124 | echo (2<=1);
CASTcasts value1 as type value2 (type in extended_value)CAST<4> 1 ~0
129 | echo (int)1;
QM_ASSIGNQuestion Mark Assign, used twice inside a question mark assign to temporarily assign result as value1 (this is followed up with an ASSIGN bytecode) 134 | JMPZ 1 J3
135 | QM_ASSIGN 1 ~0
136 | JMP J4
137 | QM_ASSIGN 2 ~0
138 | ECHO ~0
139 | echo (1?1:2); 140 |
ASSIGN_ADDAdd value1 to value2 and store in variable indicated by value1ASSIGN_ADD $a 2
145 | $a+=2;
ASSIGN_SUBSubtract value1 from value2 and store in variable indicated by value1ASSIGN_SUB $a 2
150 | $a-=2;
ASSIGN_MULMultiply result by value1 and store in variable indicated by resultASSIGN_MUL $a 2
155 | $a*=2;
ASSIGN_DIVDivide result by value1and store in variable indicated by result.ASSIGN_DIV $a 2
160 | $a/=2;
ASSIGN_MODPerform result mod value1 and store in variable indicated by resultASSIGN_MOD $a 2
165 | $a%=2;
ASSIGN_SLShift result by value1 bits to left and store in variable indicated by resultASSIGN_SL $a 2
170 | $a<<=2;
ASSIGN_SRShift result by value1 bits to right and store in variable indicated by resultASSIGN_SR $a 2
175 | $a>>=2;
ASSIGN_CONCATConcats string values result and value1 and store in variable indicated by resultASSIGN_CONCAT $a 'z'
180 | $a.='z';
ASSIGN_BW_ORPerforms binary OR on result and value1 and stores in variable indicated by result.ASSIGN_BW_OR $a 64
185 | $a|=64;
ASSIGN_BW_ANDPerforms binary AND on result and value1 and stores in variable indicated by result.ASSIGN_BW_AND $a 64
190 | $a &=64;
ASSIGN_BW_XORPerforms binary XOR on result and value1and stores in variable indicated by result.ASSIGN_BW_XOR $a 64
195 | $a ^=64;
PRE_INCincrements variable indicated by value1 by 1 (before performing other operations) and stores in resultPRE_INC $a
200 | ++$a;
PRE_DECdecrements variable indicated by value1 by 1 (before performing other operations) and stores in resultsPRE_DEC $a
205 | --$a;
POST_INCincrements variable indicated by value1 by 1 (after performing other operations) and stores in resultPOST_INC $a ~0
210 | $a++;
POST_DECdecrements variable indicated by value1 by 1 (after performing other operations) and stores in resultPOST_DEC $a ~0
215 | $a--;
ASSIGNassigns value1 to resultASSIGN $a $b
220 | $a=$b;
ASSIGN_REFUNKNOW in phpdbg.
224 | Maybe you could refer to ASSIGN_REF
UNKNOW
ECHODump textECHO "hello world"
230 | echo "hello world";
PRINTSame as ECHO?ECHO<1> "hello world"
235 | print 'hello world';
236 | If you want to refer the opcodes in vld,
you could see PRINT 237 |
JMPUnconditonally jump to the address#0 IS_EQUAL $a "a" ~0
242 | #1 JMPZ ~0 J4
243 | #2 ECHO 1
244 | #3 JMP J5
245 | #4 ECHO 2
246 | #5 RETURN<-1> 1

247 | if($a=="a"){echo 1;}else{echo 2;}
JMPZJump to the address if the value is zeroYou could see the opcodes in JMP
JMPNZJump to the address if the value is not zero...
256 | JMPNZ ~0 JX
257 | ...

258 | if($b!=0){...} 259 |
JMPZNZJump to the address given in the operands if the value is zero;
jump to the address given in extended data if nonzero.
UNKNOW in phpdbg
264 | You could refer to JMPZNZ
JMPZ_EXJump to the address if the value is zero.#0 JMPZ_EX $a J2 ~0
269 | #1 BOOL true ~0
270 | #2 JMPZ ~0
271 | #3 RETURN<-1> 1

272 | if($a&&true){}
JMPNZ_EXJump to the address if the value is not zero.#0 JMPZ_EX $a J2 ~0
277 | #1 BOOL true ~0
278 | #2 JMPZ ~0
279 | #3 RETURN<-1> 1

280 | if($a||true){}
CASEUNKNOWDo not found CASE opcode in phpdbg,
285 | You could refer to CASE
SWITCH_FREERelease the allocated space of "value"?Do not found SWITCH_FREE in phpdbg,
290 | You could refer to SWITCH_FREE 291 |
BRKIt means "break" in vld,
But not found this opcode in phpdbg.
295 | If you want to break in while-loop(or something else),phpdbg will simply use JMP opcode jump out the loop,instead of use "BRK" opcode.
#0 JMP J2
297 | #1 JMP J3
298 | #2 JMPNZ 1 J1
299 | #3 RETURN<-1> 1

300 | while(1){break;}
301 | You also could see BRK
CONTSame as BRK opcode,
305 | this opcode means "continue" in vld,
306 | But not found this opcode in phpdbg.
307 | phpdbg still use JMP to control the flow in loop.
You could refer to CONT
BOOLconvert value to boolean and store in result#0 JMPZ_EX $a J2 ~0
313 | #1 BOOL true ~0
314 | #2 JMPZ ~0
315 | #3 RETURN<-1> 1

316 | if($a&&true){}
ROPE_INITwhen create a string that cotains variable,
320 | this opcode used to init this string and store the string of begining part to result
ROPE_INIT<3> "Test" ~1
322 | ROPE_ADD<1> ~1 $a ~1
323 | ROPE_END<2> ~1 " Test" ~0
324 | ECHO ~0

325 | echo "Test$a Test";
ROPE_ADDafter ROPE_INIT opcode,continue add a variable to string,and store the string to result.Could see ROPE_INIT part
ROPE_ENDafter ROPE_INIT opcode,continue add a string to the whole string,and treat the string just added as the end of the whole string.Could see ROPE_INIT part
FAST_CONCATconcats value1 and value2,than stored it to the result 338 | FAST_CONCAT "Test" $a ~0
339 | ECHO ~0

340 | echo "Test$a"; 341 |
BEGIN_SILENCEprepare to perform function call without displaying error messagesBEGIN_SILENCE ~0
346 | INIT_FCALL<1> 96 "file"
SEND_VAL"non_existent_file" 1
347 | DO_ICALL @1
348 | END_SILENCE ~0
349 | ASSIGN $a @1
350 | RETURN<-1> 1

351 | $a = @file("non_existent_file");
END_SILENCEno longer surpress error messagesSee BEGIN_SILENCE part
INIT_FCALLinit a function going to callINIT_FCALL<1> 96 "abs"
360 | SEND_VAL 2 1
361 | DO_ICALL

362 | abs(2);
INIT_DYNAMIC_CALLcall to function dynamiclyASSIGN $x "phpinfo"
367 | INIT_DYNAMIC_CALL $x
368 | DO_FCALL

369 | $x = 'phpinfo';
$x();
INIT_FCALL_BY_NAMEcall to functionINIT_FCALL_BY_NAME "test"
374 | DO_FCALL @1
375 | ASSIGN $a @1

376 | $a = test();
DO_FCALLCall a function.
380 | If the result of called function was stored to a variable,this opcode must take a result!
See INIT_DYNAMIC_CALL and INIT_FCALL_BY_NAME part
DO_FCALL_BY_NAMECall a function by name.UNKNOW in phpdbg,
386 | You could see DO_FCALL_BY_NAME
RETURNReturn value from a funciton.RETURN 1
391 | return 1;
RECVReceive the number of functoin argumentsRECV 1 $a
396 | RETURN<-1> null

397 | function test($a){}
RECV_INITInitialize a function argument with "value" if not received from caller.
401 | Otherwise same as RECV.
RECV_INIT 1 "test" $t
403 | RETURN<-1> null

404 | function a($t="test"){}
SEND_VALPass the constant value as an actual parameter to a function.INIT_FCALL<2> 112 "hello"
409 | SEND_VAL "world" 1
410 | SEND_VAL "ok" 2
411 | DO_FCALL

412 | hello("world","ok");
SEND_VAL_EXPass the constant value as an actual parameter to a function.Same as SEND_VAL_EXINIT_FCALL_BY_NAME<2> "hello"
417 | SEND_VAL_EX "world" 1
418 | SEND_VAL_EX "ok" 2
419 | DO_FCALL

420 | hello("world","ok");
SEND_VARPass the variable value as an actual parameter to a function.ASSIGN $a 1
425 | INIT_FCALL<1> 96 "abs"
426 | SEND_VAR $a 1
427 | DO_ICALL

428 | $a=1;abs($a);
SEND_VAR_EXPass the variable value as an actual parameter to a function.Same as SEND_VAR.ASSIGN $a 1
433 | INIT_FCALL_BY_NAME<1> "test"
434 | SEND_VAR_EX $a 1
435 | DO_ICALL

436 | $a=1;test($a);
SEND_REFPass the reference value as an actual parameter to a function.INIT_FCALL<1> 96 "each"
441 | SEND_REF $a 1
442 | DO_ICALL

443 | @each($a);
NEWConstruct an instance of "type" and store the reference to the object into "result".NEW<2> "A" @1
448 | SEND_VAL_EX "a" 1
449 | DO_FCALL
450 | FREE @1

451 | new A("a"); 452 |
INIT_NS_FCALL_BY_NAMENo sample in vld or phpdbg.UNKNOW
FREERelease the allocated space of the value.Could see NEW part
INIT_ARRAYAllocate a new array with elem-value as the first element of the array.UNKNOW in phpdbg,
465 | You could refer to INIT_ARRAY
ADD_ARRAY_ELEMENTAdd elem-value as an element to array-valueUNKNOW in phpdbg,
470 | You could refer to ADD_ARRAY_ELEMENT
INCLUDE_OR_EVALInclude the file specified by filename and eval it.INCLUDE_OR_EVAL<2> "test.php"
475 | INCLUDE_OR_EVAL<1> "echo 1;"

476 | include "test.php";
477 | eval("echo 1;");
UNSET_CVUnset the variable.UNSET_CV $A
482 | unset($A);
UNSET_VARUnset the variable.ASSIGN $A "x"
487 | UNSET_VAR<4> $A

488 | $A="x";
489 | unset($$A);
UNSET_DIMUnset the entry of array-value, which is specified by indexUNSET_DIM $A 0
494 | unset($A[0]);
UNSET_OBJUnset the property of the current objectUNSET_OBJ<8> $A "test"
499 | unset($A->test);
FE_RESET_RInitialize an iterator on array-value. If the array is empty, jump to address.#0 ASSIGN $a array(3)
504 | #1 FE_RESET_R $a J5 @1
505 | #2 FE_FETCH_R<96> @1 $num
506 | #3 ECHO<1> $num
507 | #4 JMP J2
508 | #5 FE_FREE @1

509 | $a = array(1,2,3);
510 | foreach($a as $num){
511 | print $num;
}
FE_FETCH_RFetch an element from iterator.
If no element is available, jump to the address that FE_RESET_R opcode setted.
Could see FE_RESET_R part.
EXITExit running after dumping "message".EXIT "foo"
520 | die("foo");
FETCH_Rfetch Variable variables.ASSIGN $a "x"
525 | FETCH_R<4> $a ~1
526 | ECHO ~1

527 | $a="x";
528 | echo $$a;
FETCH_DIM_Rfetch value of variables by index.FETCH_R<4> $a ~1
533 | FETCH_DIM_R ~1 0 ~2
534 | ECHO ~2

535 | echo $$a[0];

536 | FETCH_DIM_R $x 0
537 | $x[0];
FETCH_OBJ_Rfetch property value of Variable variablesFETCH_R<4> $a ~1
542 | FETCH_OBJ_R ~1 "test" ~2
543 | ECHO ~2

544 | echo($$a->test); 545 |
FETCH_Wfetch Variable variables and make it writable.ASSIGN $x 1
550 | ASSIGN $a "x"
551 | FETCH_W<4> $a @2
552 | ASSIGN @2 2

553 | $x=1;
554 | $a="x";
555 | $$a=2;
FETCH_DIM_Wfetch Variable variables by index and make it writable.FETCH_DIM_W $x 0 @0
560 | ASSIGN_DIM @0 1
561 | OP_DATA 2

562 | $x[0][1]=2;
FETCH_OBJ_Wfetch property value of Variable variables and make it writable.FETCH_OBJ_W $x "t" @0
567 | ASSIGN_OBJ<16> @0 "test"
568 | OP_DATA 1

569 | $x->t->test=1;
FETCH_RWfetch value of Variable variables.FETCH_RW<4> $a @0
574 | POST_INC @0;

575 | $$a++;
FETCH_DIM_RWfetch value of Variable variables by index.FETCH_DIM_RW $a 0 @0
580 | POST_INC @0

581 | $a[0]++;
FETCH_OBJ_RWfetch property value of Variable variablesFETCH_OBJ_RW $a "b" @0
586 | POST_INC_OBJ<16> @0 "c"

587 | $a->b->c++;
FETCH_ISFetch the value from variable which is to be used to test if it is set or not, through isset()/isempty().FETCH_IS<2> "_GET" ~0
592 | ISSET_ISEMPTY_DIM_OBJ ~0 0

593 | isset($_GET[0]);
FETCH_DIM_ISNo php sample.
FETCH_OBJ_ISNo php sample.
FETCH_FUNC_ARGfetch value of Variable variables as arg of functionINIT_FCALL_BY_NAME<1> "test"
606 | CHECK_FUNC_ARG 1
607 | FETCH_FUNC_ARG<4> $a @0
608 | SEND_FUNC_ARG @0 1
609 | DO_FCALL

610 | test($$a);
FETCH_DIM_FUNC_ARGfetch value of variable by index as arg of functionINIT_FCALL_BY_NAME<1> "test"
615 | CHECK_FUNC_ARG 1
616 | FETCH_DIM_FUNC_ARG $a 0 @0
617 | SEND_FUNC_ARG @0 1
618 | DO_FCALL

619 | test($a[0]);
FETCH_OBJ_FUNC_ARGfetch property value of variable as arg of functionINIT_FCALL_BY_NAME<1> "test"
624 | CHECK_FUNC_ARG 1
625 | FETCH_OBJ_FUNC_ARG $a "b" @0
626 | SEND_FUNC_ARG @0 1
627 | DO_FCALL

628 | test($a->b);
FETCH_UNSETFetch a variable for the purpose of unset() operation.FETCH_UNSET<4> $A @1
633 | UNSET_DIM @1 0

634 | unset($$A[0]);
FETCH_DIM_UNSETFetch a variable by index for the purpose of unset() operation.FETCH_DIM_UNSET $a 0 @0
639 | UNSET_OBJ @0 "b"

640 | unset($a[0]->b);
FETCH_OBJ_UNSETFetch a property value of variable for the purpose of unset() operation.FETCH_OBJ_UNSET $a "b" @0
645 | UNSET_OBJ<16> @0 "c"

646 | unset($a->b->c);
FETCH_LIST_RFetch array list.FETCH_LIST_R array(2) 0 @0
651 | ASSIGN $x @0
652 | FETCH_LIST_R array(2) 1 @2
653 | ASSIGN $b @2

654 | list($x,$b) = array("x","b"); 655 |
FETCH_DIM_TMP_VARNo php sample in phpdbgYou could refer to FETCH_DIM_TMP_VAR
FETCH_CONSTANTfetch value by const name.FETCH_CONSTANT "A" ~0
664 | ECHO ~0

665 | echo A;
GOTONo sample in phpdbg and vld,
669 | phpdbg use JMP opcode to control flow.
EXT_STMTNo php sample
EXT_FCALL_BEGINNo php sample
EXT_FCALL_ENDNo php sample
EXT_NOPNo php sample
TICKSTICKS<100>
691 | declare(ticks=100);
SEND_VAR_NO_REFNo php sample
CATCHcatch when Exception get throw.#0 THROW $t
700 | #1 JMP J4
701 | #2 CATCH<1> "A" $e
702 | #3 ECHO "catch"
703 | #4 RETURN<-1> 1

704 | try{throw $t}
705 | catch(A $e){echo "catch";} 706 |
THROWthrow some Exception.THROW $t
711 | throw $t;
FETCH_CLASSfetch static classFETCH_CLASS $obj @0
716 | FETCH_CLASS_CONSTANT @0 "a"

717 | $obj::a;
FETCH_CLASS_CONSTANTfetch static constant from classCould see FETCH_CLASS part.
FETCH_STATIC_PROP_Rfetch static property value from classFETCH_CLASS $obj @0
726 | FETCH_STATIC_PROP_R "a" @0 ~1

727 | $obj::$a;
FETCH_STATIC_PROP_RWfetch static property value from class,same as FETCH_STATIC_PROP_R but make it readable and writable.FETCH_CLASS $obj @0
732 | FETCH_STATIC_PROP_RW "a" @0 @1
733 | POST_INC @1 ~2

734 | $obj::$a++;
FETCH_STATIC_PROP_Wfetch static property value from class AND make it writable.FETCH_CLASS $obj @0
739 | FETCH_STATIC_PROP_W "a" @0 @1
740 | ASSIGN @1 1

741 | $obj::$a=1;
CLONEclone an objectCLONE $t ~0
746 | clone $t;
RETURN_BY_REFNo sample in phpdbg
INIT_METHOD_CALLPrepare for a method call. Followed by DO_FCALL.INIT_METHOD_CALL $obj "a"
755 | DO_FCALL

756 | $obj->a();
INIT_STATIC_METHOD_CALLPrepare for a static method call. Followed by DO_FCALL.FETCH_CLASS $obj @0
761 | INIT_STATIC_METHOD_CALL @0 "a"
762 | DO_FCALL

763 | $obj::a();
ISSET_ISEMPTY_CVcheck wether a variable is setted and store the result.ISSET_ISEMPTY_CV $a ~0
768 | isset($a);
ISSET_ISEMPTY_VARcheck wether a variable is setted and store the result.ISSET_ISEMPTY_VAR<4> $a ~0
773 | isset($$a);
ISSET_ISEMPTY_DIM_OBJcheck wether a variable is setted by its index and store the result.ISSET_ISEMPTY_DIM_OBJ $a 0 ~0
778 | isset($a[0]);
ZEND_SEND_VAL_EXCould see SEND_VAL_EX part.
ZEND_SEND_VARCould see SEND_VAR part.
ZEND_INIT_USER_CALL
ZEND_SEND_ARRAY
ZEND_SEND_USER
STRLENget length of string and store the resultSTRLEN $a
strlen($a);
DEFINED
ZEND_TYPE_CHECK
ZEND_VERIFY_RETURN_TYPE
ZEND_FE_RESET_RW
ZEND_FE_FETCH_RW
ZEND_FE_FREE
ZEND_INIT_DYNAMIC_CALL
ZEND_DO_ICALL
ZEND_DO_UCALL
ZEND_DO_FCALL_BY_NAME
PRE_INC_OBJSame as PRE_INC but operate to an objectPRE_INC_OBJ $obj "a"
847 | ++$obj->a;
PRE_DEC_OBJSame as PRE_DEC but operate to an objectPRE_DEC_OBJ $obj "a"
--$obj->a;
POST_INC_OBJSame as POST_INC but operate to an objectPOST_INC_OBJ $obj "a" ~0
856 | $obj->a++;
POST_DEC_OBJSame as POST_DEC but operate to an objectPOST_DEC_OBJ $obj "a" ~0
861 | $obj->a--;
ASSIGN_OBJfetch an object and wait for OP_DATA opcode.ASSIGN_OBJ $obj "a"
866 | OP_DATA $t

867 | $obj->a=$t;
INSTANCEOFINSTANCEOF $a "A" ~0
872 | $a instanceof A;
DECLARE_CLASSdeclare a class by nameJMPZ true JX
877 | DECLARE_CLASS "a" @0

878 | if(true){class A{}}
DECLARE_INHERITED_CLASSwhen declare a class by name,if declared class extends other class,will execute this opcode.JMPZ true JX
883 | DECLARE_INHERITED_CLASS "a" "C" @0

884 | if(true){
885 | class a extends C{}
}
DECLARE_FUNCTIONdeclare function by nameJMPZ true JX
890 | DECLARE_FUNCTION "test"

891 | if(true){
892 | function test(){}
893 | }
RAISE_ABSTRACT_ERROR
DECLARE_CONSTdeclare a const valueDECLARE_CONST "a" 1
902 | const a=1;
ADD_INTERFACEwhen declare class by name,if declared class implements other interface,will execute this opcode.JMPZ true JX
907 | DECLARE_CLASS "a" @0
908 | ADD_INTERFACE @0 "C"
909 | VERIFY_ABSTRACT_CLASS @0

910 | if(true){
911 | class a implements C{}
}
DECLARE_INHERITED_CLASS_DELAYED
VERIFY_ABSTRACT_CLASSCould see ADD_INTERFACE part.
ASSIGN_DIMset value of variable by index,followed by OP_DATA.ASSIGN_DIM $x 0
924 | OP_DATA 2

925 | $x[0]=2;
OP_DATAset value after "ASSIGN" opcodes(such as ASSIGN_DIM,ASSIGN_OBJ...) executed.Could see ASSIGN_DIM part.
ISSET_ISEMPTY_PROP_OBJcheck wether a property value of an object is setted and store the resultISSET_ISEMPTY_PROP_OBJ $a "b" ~0
934 | isset($a->b);
HANDLE_EXCEPTION
USER_OPCODE
ZEND_ASSERT_CHECK
JMP_SETset the variable if value is not zero,otherwise jump to addressJMP_SET $b JX ~0
951 | QM_ASSIGN 2 ~0
952 | ASSIGN $t ~0

953 | $t=$b?:2;
DECLARE_LAMBDA_FUNCTIONDECLARE_LAMBDA_FUNCTION "\000{clousre}C:\\"+ ~0
958 | INIT_DYNAMIC_CALL ~0
959 | DO_FCALL

960 | (function(){return "phpinfo";})();
ADD_TRAITfollowed by BIND_TRAITSDECLARE_CLASS "a" @0
965 | ADD_TRAIT @0 "B"
966 | BIND_TRAITS @0

967 | class A{
968 | use B;
969 | }
BIND_TRAITSbind trait in class.Could see ADD_TRAIT part.
ZEND_SEPARATE
ZEND_FETCH_CLASS_NAME
ZEND_CALL_TRAMPOLINE
ZEND_DISCARD_EXCEPTION
ZEND_YIELD
ZEND_GENERATOR_RETURN
ZEND_FAST_CALL
ZEND_FAST_RET
ZEND_RECV_VARIADIC
ZEND_SEND_UNPACK
ZEND_POW
ZEND_ASSIGN_POW
ZEND_BIND_GLOBAL(vld)
BIND_GLOBAL
declare an global variableBIND_GLOBAL $a "a"
1026 | global $a;
ZEND_COALESCE
ZEND_SPACESHIP
ZEND_DECLARE_ANON_CLASS
ZEND_DECLARE_ANON_INHERITED_CLASS
ZEND_FETCH_STATIC_PROP_R
ZEND_FETCH_STATIC_PROP_W
ZEND_FETCH_STATIC_PROP_RW
ZEND_FETCH_STATIC_PROP_IS
ZEND_FETCH_STATIC_PROP_FUNC_ARG
ZEND_FETCH_STATIC_PROP_UNSET
ZEND_UNSET_STATIC_PROP
ZEND_ISSET_ISEMPTY_STATIC_PROP
ZEND_FETCH_CLASS_CONSTANT
ZEND_BIND_LEXICAL
ZEND_BIND_STATIC
ZEND_FETCH_THIS
ZEND_SEND_FUNC_ARG
ZEND_ISSET_ISEMPTY_THIS
ZEND_SWITCH_LONG
ZEND_SWITCH_STRING
ZEND_IN_ARRAY
ZEND_COUNT
ZEND_GET_CLASS
ZEND_GET_CALLED_CLASS
ZEND_GET_TYPE
ZEND_FUNC_NUM_ARGS
ZEND_FUNC_GET_ARGS
ZEND_UNSET_CV
1142 | 1143 | --------------------------------------------------------------------------------