]> granicus.if.org Git - php/commitdiff
Use memcmp() instead of strncmp()
authorDmitry Stogov <dmitry@zend.com>
Mon, 16 Mar 2015 12:53:54 +0000 (15:53 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 16 Mar 2015 12:53:54 +0000 (15:53 +0300)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/standard/type.c

index ba5619f593c7e1bc2f3e33b457c5bdedb66444ae..d7cf7ad9c863c0d01cecb8f2536ef4432580f422 100644 (file)
@@ -6936,7 +6936,7 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
                        if (Z_TYPE_P(value) == opline->extended_value) {
                                zend_class_entry *ce = Z_OBJCE_P(value);
                                if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
-                                               && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+                                               && !memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1)) {
                                        ZVAL_FALSE(EX_VAR(opline->result.var));
                                } else {
                                        ZVAL_TRUE(EX_VAR(opline->result.var));
index 454e97f4009b91ef869d0f77b1523a9db7b8860d..46da517a62217d6ce3d7c76087875048c734c1b5 100644 (file)
@@ -3820,7 +3820,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(
                        if (Z_TYPE_P(value) == opline->extended_value) {
                                zend_class_entry *ce = Z_OBJCE_P(value);
                                if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
-                                               && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+                                               && !memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1)) {
                                        ZVAL_FALSE(EX_VAR(opline->result.var));
                                } else {
                                        ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -9976,7 +9976,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZE
                        if (Z_TYPE_P(value) == opline->extended_value) {
                                zend_class_entry *ce = Z_OBJCE_P(value);
                                if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
-                                               && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+                                               && !memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1)) {
                                        ZVAL_FALSE(EX_VAR(opline->result.var));
                                } else {
                                        ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -13324,7 +13324,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZE
                        if (Z_TYPE_P(value) == opline->extended_value) {
                                zend_class_entry *ce = Z_OBJCE_P(value);
                                if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
-                                               && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+                                               && !memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1)) {
                                        ZVAL_FALSE(EX_VAR(opline->result.var));
                                } else {
                                        ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -26165,7 +26165,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEN
                        if (Z_TYPE_P(value) == opline->extended_value) {
                                zend_class_entry *ce = Z_OBJCE_P(value);
                                if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
-                                               && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+                                               && !memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1)) {
                                        ZVAL_FALSE(EX_VAR(opline->result.var));
                                } else {
                                        ZVAL_TRUE(EX_VAR(opline->result.var));
index d6ea5d58eca63fb4d2af37f1e666681de20b824c..f884017f6f8ec9a6c106767cdcd6e46f720b3337 100644 (file)
@@ -228,7 +228,7 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
                if (type == IS_OBJECT) {
                        zend_class_entry *ce = Z_OBJCE_P(arg);
                        if (ce->name->len == sizeof(INCOMPLETE_CLASS) - 1
-                                       && !strncmp(ce->name->val, INCOMPLETE_CLASS, ce->name->len)) {
+                                       && !memcmp(ce->name->val, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1)) {
                                RETURN_FALSE;
                        }
                } else if (type == IS_RESOURCE) {