From 37ddf8e922fc971abaef3a73daf15c3cce5bcc7f Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sun, 29 Feb 2004 18:31:29 +0000 Subject: [PATCH] - Apply fixes by Timm. --- Zend/zend_reflection_api.c | 9 +++++++-- ext/reflection/php_reflection.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 0d4dd48eb9..c71044df04 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -1800,9 +1800,9 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob zval_add_ref(&argument); } } else { + convert_to_string_ex(&argument); if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); return; } @@ -2302,6 +2302,11 @@ ZEND_METHOD(reflection_class, newInstance) zend_fcall_info fci; zend_fcall_info_cache fcc; + if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %s", ce->name); + return; + } + params = safe_emalloc(sizeof(zval **), argc, 0); if (zend_get_parameters_array_ex(argc, params) == FAILURE) { efree(params); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 0d4dd48eb9..c71044df04 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1800,9 +1800,9 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob zval_add_ref(&argument); } } else { + convert_to_string_ex(&argument); if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); return; } @@ -2302,6 +2302,11 @@ ZEND_METHOD(reflection_class, newInstance) zend_fcall_info fci; zend_fcall_info_cache fcc; + if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %s", ce->name); + return; + } + params = safe_emalloc(sizeof(zval **), argc, 0); if (zend_get_parameters_array_ex(argc, params) == FAILURE) { efree(params); -- 2.40.0