From 40dd3f4f88d858f95fdf8dd505c970ecfcc674f6 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 1 Jul 2003 21:30:21 +0000 Subject: [PATCH] __clone might not be defined --- Zend/zend_execute.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 00da3d50c7d..5b6c38994e1 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -3140,19 +3140,21 @@ int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS) } ce = Z_OBJCE_P(obj); - clone = ce->clone; + clone = ce ? ce->clone : NULL; - if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) { - /* Ensure that if we're calling a private function, we're allowed to do so. - */ - if (ce != EG(scope)) { - zend_error(E_ERROR, "Call to private __clone from context '%s'", EG(scope) ? EG(scope)->name : ""); - } - } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { - /* Ensure that if we're calling a protected function, we're allowed to do so. - */ - if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to protected __clone from context '%s'", EG(scope) ? EG(scope)->name : ""); + if (ce && clone) { + if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) { + /* Ensure that if we're calling a private function, we're allowed to do so. + */ + if (ce != EG(scope)) { + zend_error(E_ERROR, "Call to private __clone from context '%s'", EG(scope) ? EG(scope)->name : ""); + } + } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { + /* Ensure that if we're calling a protected function, we're allowed to do so. + */ + if (!zend_check_protected(clone->common.scope, EG(scope))) { + zend_error(E_ERROR, "Call to protected __clone from context '%s'", EG(scope) ? EG(scope)->name : ""); + } } }