From 9702c70a3501ad800d25bb73c62e1fb30b6d576f Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 2 Sep 2003 14:08:59 +0000 Subject: [PATCH] Synch/Unify error messages related to function/method calls --- Zend/zend_execute.c | 6 +++--- Zend/zend_object_handlers.c | 4 ++-- Zend/zend_objects.c | 4 ++-- tests/classes/factory_and_singleton_002.phpt | 2 +- tests/classes/factory_and_singleton_003.phpt | 2 +- tests/classes/factory_and_singleton_004.phpt | 2 +- tests/classes/factory_and_singleton_005.phpt | 2 +- tests/classes/factory_and_singleton_006.phpt | 2 +- tests/classes/factory_and_singleton_007.phpt | 2 +- tests/classes/factory_and_singleton_008.phpt | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ae957a726a..de31c1c89c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2475,7 +2475,7 @@ int zend_init_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS) } if (zend_hash_find(EG(function_table), function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) { - zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval); + zend_error(E_ERROR, "Call to undefined function %s()", function_name_strval); } if (!is_const) { @@ -3122,13 +3122,13 @@ int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS) /* 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 : ""); + zend_error(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, 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 : ""); + zend_error(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); } } } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 25d10aaf54..a5914cbad9 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -765,13 +765,13 @@ static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) /* Ensure that if we're calling a private function, we're allowed to do so. */ if (object->value.obj.handlers->get_class_entry(object TSRMLS_CC) != EG(scope)) { - zend_error(E_ERROR, "Call to private constructor from context '%s'", EG(scope) ? EG(scope)->name : ""); + zend_error(E_ERROR, "Call to private %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : ""); } } else if ((constructor->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(constructor->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to protected constructor from context '%s'", EG(scope) ? EG(scope)->name : ""); + zend_error(E_ERROR, "Call to protected %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : ""); } } } diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 114d069dd0..67e943428a 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -50,7 +50,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl zend_nuke_object(object TSRMLS_CC); /* unfortunately we *must* destroy it now anyway */ zend_error(EG(in_execution) ? E_ERROR : E_WARNING, - "Call to private %s::__destruct from context '%s'%s", + "Call to private %s::__destruct() from context '%s'%s", ce->name, EG(scope) ? EG(scope)->name : "", EG(in_execution) ? "" : " during shutdown ignored"); @@ -64,7 +64,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl zend_nuke_object(object TSRMLS_CC); /* unfortunately we *must* destroy it now anyway */ zend_error(EG(in_execution) ? E_ERROR : E_WARNING, - "Call to protected %s::__destruct from context '%s'%s", + "Call to protected %s::__destruct() from context '%s'%s", ce->name, EG(scope) ? EG(scope)->name : "", EG(in_execution) ? "" : " during shutdown ignored"); diff --git a/tests/classes/factory_and_singleton_002.phpt b/tests/classes/factory_and_singleton_002.phpt index 2cb9a892f0..3308a561a5 100755 --- a/tests/classes/factory_and_singleton_002.phpt +++ b/tests/classes/factory_and_singleton_002.phpt @@ -97,4 +97,4 @@ int(1) int(1) Done -Warning: Call to protected test::__destruct from context '' during shutdown ignored in Unknown on line 0 +Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/tests/classes/factory_and_singleton_003.phpt b/tests/classes/factory_and_singleton_003.phpt index d5fc00491b..d81cc4642c 100755 --- a/tests/classes/factory_and_singleton_003.phpt +++ b/tests/classes/factory_and_singleton_003.phpt @@ -15,4 +15,4 @@ $obj = new test; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to protected constructor from context '' %sfactory_and_singleton_003.php on line %d +Fatal error: Call to protected test::__construct() from context '' %sfactory_and_singleton_003.php on line %d diff --git a/tests/classes/factory_and_singleton_004.phpt b/tests/classes/factory_and_singleton_004.phpt index 047762d629..01c53d85a3 100755 --- a/tests/classes/factory_and_singleton_004.phpt +++ b/tests/classes/factory_and_singleton_004.phpt @@ -15,4 +15,4 @@ $obj = new test; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to private constructor from context '' %sfactory_and_singleton_004.php on line %d +Fatal error: Call to private test::__construct() from context '' %sfactory_and_singleton_004.php on line %d diff --git a/tests/classes/factory_and_singleton_005.phpt b/tests/classes/factory_and_singleton_005.phpt index fab99e312d..2cd7e5cc99 100755 --- a/tests/classes/factory_and_singleton_005.phpt +++ b/tests/classes/factory_and_singleton_005.phpt @@ -16,4 +16,4 @@ $obj = NULL; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to protected test::__destruct from context '' in %sfactory_and_singleton_005.php on line %d +Fatal error: Call to protected test::__destruct() from context '' in %sfactory_and_singleton_005.php on line %d diff --git a/tests/classes/factory_and_singleton_006.phpt b/tests/classes/factory_and_singleton_006.phpt index 6381550711..81cf714888 100755 --- a/tests/classes/factory_and_singleton_006.phpt +++ b/tests/classes/factory_and_singleton_006.phpt @@ -16,5 +16,5 @@ $obj = NULL; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to private test::__destruct from context '' in %sfactory_and_singleton_006.php on line %d +Fatal error: Call to private test::__destruct() from context '' in %sfactory_and_singleton_006.php on line %d diff --git a/tests/classes/factory_and_singleton_007.phpt b/tests/classes/factory_and_singleton_007.phpt index 5352dedb00..8ca8982fa3 100755 --- a/tests/classes/factory_and_singleton_007.phpt +++ b/tests/classes/factory_and_singleton_007.phpt @@ -17,4 +17,4 @@ $obj = NULL; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to protected __clone from context '' %sfactory_and_singleton_007.php on line %d +Fatal error: Call to protected test::__clone() from context '' %sfactory_and_singleton_007.php on line %d diff --git a/tests/classes/factory_and_singleton_008.phpt b/tests/classes/factory_and_singleton_008.phpt index 77e3d78dfa..b3fbf29f2e 100755 --- a/tests/classes/factory_and_singleton_008.phpt +++ b/tests/classes/factory_and_singleton_008.phpt @@ -17,4 +17,4 @@ $obj = NULL; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to private __clone from context '' %sfactory_and_singleton_008.php on line %d +Fatal error: Call to private test::__clone() from context '' %sfactory_and_singleton_008.php on line %d -- 2.49.0