]> granicus.if.org Git - php/commitdiff
Fix #28641: Instance of Interface
authorMarcus Boerger <helly@php.net>
Sat, 5 Jun 2004 14:59:21 +0000 (14:59 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 5 Jun 2004 14:59:21 +0000 (14:59 +0000)
Zend/zend_API.c

index ac7828437827a73cb217fc2053eed395de4fdf19..793727900c118ac40f52d92ab2428ec87029377b 100644 (file)
@@ -694,6 +694,11 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
        zval *tmp;
        zend_object *object;
 
+       if (class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
+               char *what = class_type->ce_flags & ZEND_ACC_INTERFACE ? "interface" : "abstract class";
+               zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name);
+       }
+
        if (!class_type->constants_updated) {
                zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
                zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);