From: Nikita Popov Date: Wed, 15 Nov 2017 22:01:11 +0000 (+0100) Subject: Merge branch 'PHP-7.1' into PHP-7.2 X-Git-Tag: php-7.2.1RC1~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6640e03df84586bc64b7879376ce7ebb34c82522;p=php Merge branch 'PHP-7.1' into PHP-7.2 --- 6640e03df84586bc64b7879376ce7ebb34c82522 diff --cc NEWS index f32c78a4f8,d5b94bd809..a747b52838 --- a/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) diff --cc Zend/zend_vm_def.h index 1c3668088e,08eb762a99..dc52e00bc2 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@@ -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)) { @@@ -4968,9 -5090,8 +4968,9 @@@ */ 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(); } } diff --cc Zend/zend_vm_execute.h index 6b83684b7f,94949e8881..d1ea87bf68 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@@ -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)) { @@@ -3335,9 -3317,8 +3335,9 @@@ */ 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)) { @@@ -26874,9 -28041,8 +26874,9 @@@ */ 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)) { @@@ -33762,9 -35371,8 +33762,9 @@@ */ 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)) { @@@ -48605,9 -51630,8 +48605,9 @@@ */ 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(); } }