if (EX(opline)->op1.op_type == IS_UNUSED) {
if (EX(opline)->extended_value == ZEND_FETCH_CLASS_SELF) {
if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot fetch self:: when no class scope is active");
+ zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
}
EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope);
NEXT_OPCODE();
NEXT_OPCODE();
} else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_PARENT) {
if (!EG(scope)) {
- zend_error(E_ERROR, "Cannot fetch parent:: when no class scope is active");
+ zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
}
if (!EG(scope)->parent) {
- zend_error(E_ERROR, "Cannot fetch parent:: as current class scope has no parent");
+ zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
}
EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope)->parent;
NEXT_OPCODE();
last = tsrm_strtok_r(p->value.str.val, ":", &temp);
+ if (strcasecmp(last, "self")==0) {
+ if (EG(scope)) {
+ last = EG(scope)->name;
+ } else {
+ zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
+ }
+ } else if (strcasecmp(last, "parent")==0) {
+ if (!EG(scope)) {
+ zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
+ } else if (!EG(scope)->parent) {
+ zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
+ } else {
+ last = EG(scope)->parent->name;
+ }
+ }
+
+
if (zend_lookup_class(last, strlen(last), &ce TSRMLS_CC) == FAILURE) {
zend_error(E_ERROR, "Undefined class '%s'", last);
}