case ZEND_DECLARE_CLASS: {
zend_class_entry *ce;
- zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce);
+ if (zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce)==FAILURE) {
+ zend_error(E_ERROR, "Internal Zend error - Missing class information for %s", opline->op1.u.constant.value.str.val);
+ return FAILURE;
+ }
(*ce->refcount)++;
if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, ce, sizeof(zend_class_entry), NULL)==FAILURE) {
(*ce->refcount)--;
char *class_name, *parent_name;
zend_function tmp_zend_function;
zval *tmp;
+ int found_ce;
- zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce);
- (*ce->refcount)++;
+
+ found_ce = zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce);
/* Restore base class / derived class names */
parent_name = opline->op2.u.constant.value.str.val;
}
*class_name++ = 0;
+ if (found_ce==FAILURE) {
+ zend_error(E_ERROR, "Cannot redeclare class %s", class_name);
+ return FAILURE;
+ }
+
+ (*ce->refcount)++;
+
/* Obtain parent class */
if (zend_hash_find(class_table, parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) {
if (!compile_time) {