]> granicus.if.org Git - php/commitdiff
- Fixed Bug #38064 ignored constructor visibility
authorMarcus Boerger <helly@php.net>
Mon, 7 Aug 2006 23:16:20 +0000 (23:16 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 7 Aug 2006 23:16:20 +0000 (23:16 +0000)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 96757e533de1997e6aab779a1fafe18796e59802..6f75b14bbae5d054cce8b3e65fd63a6dc4a98286 100644 (file)
@@ -1789,6 +1789,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }
 
index 133ba00af7f4eb212db4b26ba327fb655a5ffd8f..7b8b94f1b7060aa6b533ca87335c3b4cfe96adee 100644 (file)
@@ -680,6 +680,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }
 
@@ -898,6 +901,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }
 
@@ -1031,6 +1037,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }
 
@@ -1163,6 +1172,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }
 
@@ -1253,6 +1265,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
                if(!ce->constructor) {
                        zend_error_noreturn(E_ERROR, "Can not call constructor");
                }
+               if (Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+                       zend_error(E_COMPILE_ERROR, "Cannot call private %v::__constrcut()", ce->name);
+               }
                EX(fbc) = ce->constructor;
        }