From 6345105612656854e1ace2569c6cfd8b179fb5f8 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 5 Jul 2006 11:48:17 +0000 Subject: [PATCH] fix bug #38003(in classes inherited from mysqli it's possible to call private constructors from invalid context) also, use appropriate macro instead of accessing structure elements directly --- ext/mysqli/mysqli.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index dea04b70ba..213bb47e40 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -293,11 +293,12 @@ void mysqli_add_property(HashTable *h, char *pname, mysqli_read_t r_func, mysqli static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC) { mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC); + zend_class_entry * ce = Z_OBJCE_P(object); - if (obj->zo.ce != mysqli_link_class_entry && obj->zo.ce != mysqli_stmt_class_entry && - obj->zo.ce != mysqli_result_class_entry && obj->zo.ce != mysqli_driver_class_entry && - obj->zo.ce != mysqli_warning_class_entry) { - return obj->zo.ce->constructor; + if (ce != mysqli_link_class_entry && ce != mysqli_stmt_class_entry && + ce != mysqli_result_class_entry && ce != mysqli_driver_class_entry && + ce != mysqli_warning_class_entry) { + return zend_std_get_constructor(object TSRMLS_CC); } else { static zend_internal_function f; -- 2.40.0