From: Marcus Boerger Date: Mon, 20 Feb 2006 20:00:46 +0000 (+0000) Subject: - Add deprecation flag and message X-Git-Tag: RELEASE_1_2~152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b3e006e33d45d31d311851709de6e1babddaf11;p=php - Add deprecation flag and message --- diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 3bbc5a46dd..d1d4a2f744 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -136,6 +136,9 @@ typedef struct _zend_try_catch_element { /* shadow of parent's private method/property */ #define ZEND_ACC_SHADOW 0x20000 +/* deprecation flag */ +#define ZEND_ACC_DEPRECATED 0x40000 + char *zend_visibility_string(zend_uint fn_flags); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index f4fceac07f..d4aa68ba76 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -861,6 +861,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS fci->object_pp = fci_cache->object_pp; } + if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { + zend_error(E_NOTICE, "Function %s%s%s() is deprecated", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + EX(function_state).function->common.scope ? "::" : "", + EX(function_state).function->common.function_name); + } + for (i=0; iparam_count; i++) { zval *param; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e72b16c470..d4dddb36d1 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1813,10 +1813,18 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) zend_bool should_change_scope; zend_op *ctor_opline; - if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { - /* FIXME: output identifiers properly */ - zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); - ZEND_VM_NEXT_OPCODE(); /* Never reached */ + if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { + if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { + /* FIXME: output identifiers properly */ + zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + ZEND_VM_NEXT_OPCODE(); /* Never reached */ + } + if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { + zend_error(E_NOTICE, "Function %s%s%s() is deprecated", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + EX(function_state).function->common.scope ? "::" : "", + EX(function_state).function->common.function_name); + } } zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 92a06c0a3c..531d38a61e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -139,10 +139,18 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) zend_bool should_change_scope; zend_op *ctor_opline; - if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { - /* FIXME: output identifiers properly */ - zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); - ZEND_VM_NEXT_OPCODE(); /* Never reached */ + if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { + if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { + /* FIXME: output identifiers properly */ + zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); + ZEND_VM_NEXT_OPCODE(); /* Never reached */ + } + if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { + zend_error(E_NOTICE, "Function %s%s%s() is deprecated", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + EX(function_state).function->common.scope ? "::" : "", + EX(function_state).function->common.function_name); + } } zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);