- Fixed bug #30707 (Segmentation fault on exception in method). (Stas, Dmitry)
- Fixed bug #30702 (cannot initialize class variable from class constant).
(Dmitry)
+- Fixed bug #30519 (Interface not existing says Class not found). (Dmitry)
- Fixed bug #30394 (Assignment operators yield wrong result with __get/__set).
(Dmitry)
- Fixed bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with
--- /dev/null
+--TEST--
+Bug #30519 Interface not existing says Class not found
+--FILE--
+<?php
+class test implements a {
+}
+?>
+--EXPECTF--
+Fatal error: Interface 'a' not found in %sbug30519.php on line 2
+
opline->op2 = *class_name;
}
opline->result.u.var = get_temporary_variable(CG(active_op_array));
+ opline->result.u.EA.type = opline->extended_value;
opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
*result = opline->result;
}
new_class_entry->ce_flags |= class_token->u.EA.type;
if (parent_class_name && parent_class_name->op_type != IS_UNUSED) {
+ switch (parent_class_name->u.EA.type) {
+ case ZEND_FETCH_CLASS_SELF:
+ zend_error(E_COMPILE_ERROR, "Cannot use 'self' as class name as it is reserved");
+ break;
+ case ZEND_FETCH_CLASS_PARENT:
+ zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved");
+ break;
+ default:
+ break;
+ }
doing_inheritance = 1;
}
void zend_do_implements_interface(znode *interface_znode TSRMLS_DC)
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_op *opline;
+ switch (interface_znode->u.EA.type) {
+ case ZEND_FETCH_CLASS_SELF:
+ zend_error(E_COMPILE_ERROR, "Cannot use 'self' as interface name as it is reserved");
+ break;
+ case ZEND_FETCH_CLASS_PARENT:
+ zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as interface name as it is reserved");
+ break;
+ default:
+ if (CG(active_op_array)->last > 0) {
+ opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
+ if (opline->opcode == ZEND_FETCH_CLASS) {
+ opline->extended_value = ZEND_FETCH_CLASS_INTERFACE;
+ }
+ }
+ break;
+ }
+
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_ADD_INTERFACE;
opline->op1 = CG(implementing_class);
opline->op2 = *interface_znode;
#define ZEND_FETCH_CLASS_MAIN 3
#define ZEND_FETCH_CLASS_GLOBAL 4
#define ZEND_FETCH_CLASS_AUTO 5
+#define ZEND_FETCH_CLASS_INTERFACE 6
/* variable parsing type (compile-time) */
if (opline->op2.op_type == IS_UNUSED) {
- EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, ZEND_FETCH_CLASS_AUTO, opline->extended_value TSRMLS_CC);
+ EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
NEXT_OPCODE();
}
EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
break;
case IS_STRING:
- EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);
+ EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
break;
default:
zend_error(E_ERROR, "Class name must be a valid object or a string");
}
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
- zend_error(E_ERROR, "Class '%s' not found", class_name);
+ if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
+ zend_error(E_ERROR, "Interface '%s' not found", class_name);
+ } else {
+ zend_error(E_ERROR, "Class '%s' not found", class_name);
+ }
}
return *pce;
}