mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Merge branch 'PHP-8.1'
* PHP-8.1: Handle holes in zend_get_opcode_id()
This commit is contained in:
commit
55a4bae546
@ -2651,7 +2651,8 @@ function gen_vm($def, $skel) {
|
||||
fputs($f, "ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length) {\n");
|
||||
fputs($f, "\tzend_uchar opcode;\n");
|
||||
fputs($f, "\tfor (opcode = 0; opcode < (sizeof(zend_vm_opcodes_names) / sizeof(zend_vm_opcodes_names[0])) - 1; opcode++) {\n");
|
||||
fputs($f, "\t\tif (strncmp(zend_vm_opcodes_names[opcode], name, length) == 0) {\n");
|
||||
fputs($f, "\t\tconst char *opcode_name = zend_vm_opcodes_names[opcode];\n");
|
||||
fputs($f, "\t\tif (opcode_name && strncmp(opcode_name, name, length) == 0) {\n");
|
||||
fputs($f, "\t\t\treturn opcode;\n");
|
||||
fputs($f, "\t\t}\n");
|
||||
fputs($f, "\t}\n");
|
||||
|
@ -449,7 +449,8 @@ ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) {
|
||||
ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length) {
|
||||
zend_uchar opcode;
|
||||
for (opcode = 0; opcode < (sizeof(zend_vm_opcodes_names) / sizeof(zend_vm_opcodes_names[0])) - 1; opcode++) {
|
||||
if (strncmp(zend_vm_opcodes_names[opcode], name, length) == 0) {
|
||||
const char *opcode_name = zend_vm_opcodes_names[opcode];
|
||||
if (opcode_name && strncmp(opcode_name, name, length) == 0) {
|
||||
return opcode;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user