]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1' into PHP-7.2
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Nov 2017 22:01:11 +0000 (23:01 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Nov 2017 22:01:25 +0000 (23:01 +0100)
1  2 
NEWS
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

diff --cc NEWS
index f32c78a4f8f76576480c847ef191bf8c16da657d,d5b94bd8094f445bb350e7bf3186f57eccfffcb4..a747b5283841b6dbf4104673b4e0df82f4102712
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -5,8 -5,13 +5,10 @@@ PH
  - Core:
    . Fixed bug #75384 (PHP seems incompatible with OneDrive files on demand).
      (Anatol)
 +  . Fixed bug #75525 (Access Violation in vcruntime140.dll). (Anatol)
+   . Fixed bug #74862 (Unable to clone instance when private __clone defined).
+     (Daniel Ciochiu)
  
 -- CLI Server:
 -  . Fixed bug #60471 (Random "Invalid request (unexpected EOF)" using a router
 -    script). (SammyK)
 -
  - Standard:
    . Fixed bug #75511 (fread not free unused buffer). (Laruence)
    . Fixed bug #75514 (mt_rand returns value outside [$min,$max]+ on 32-bit)
index 1c3668088ef0ffb53b9c0369cd163039c63dff4a,08eb762a9996136738202c532f460ff206955d04..dc52e00bc270366faba3d9f92598685dc20c5ea5
@@@ -4957,10 -5080,9 +4957,10 @@@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        scope = EX(func)->op_array.scope;
-                       if (UNEXPECTED(ce != scope)) {
-                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                       if (!zend_check_private(clone, scope, clone->common.function_name)) {
+                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
                                FREE_OP1();
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                         */
                        scope = EX(func)->op_array.scope;
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
-                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
                                FREE_OP1();
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                }
index 6b83684b7f3386afe097c19f6b9a8fd577a0e3c3,94949e8881e06b2cb2b218c3acb429b029acdc2c..d1ea87bf682137069d0b2fa4cae012b467125293
@@@ -3324,10 -3307,9 +3324,10 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        scope = EX(func)->op_array.scope;
-                       if (UNEXPECTED(ce != scope)) {
-                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                       if (!zend_check_private(clone, scope, clone->common.function_name)) {
+                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                         */
                        scope = EX(func)->op_array.scope;
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
-                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                }
@@@ -26863,10 -28031,9 +26863,10 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        scope = EX(func)->op_array.scope;
-                       if (UNEXPECTED(ce != scope)) {
-                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                       if (!zend_check_private(clone, scope, clone->common.function_name)) {
+                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                         */
                        scope = EX(func)->op_array.scope;
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
-                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                }
@@@ -33751,10 -35361,9 +33751,10 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        scope = EX(func)->op_array.scope;
-                       if (UNEXPECTED(ce != scope)) {
-                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                       if (!zend_check_private(clone, scope, clone->common.function_name)) {
+                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                         */
                        scope = EX(func)->op_array.scope;
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
-                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
  
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                }
@@@ -48594,10 -51620,9 +48594,10 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        scope = EX(func)->op_array.scope;
-                       if (UNEXPECTED(ce != scope)) {
-                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                       if (!zend_check_private(clone, scope, clone->common.function_name)) {
+                               zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
                                zval_ptr_dtor_nogc(free_op1);
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                         */
                        scope = EX(func)->op_array.scope;
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
-                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
+                               zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(clone->common.scope->name), scope ? ZSTR_VAL(scope->name) : "");
                                zval_ptr_dtor_nogc(free_op1);
 +                              ZVAL_UNDEF(EX_VAR(opline->result.var));
                                HANDLE_EXCEPTION();
                        }
                }