Index: Zend/zend_execute_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute_API.c,v retrieving revision 1.331.2.20.2.24.2.8 diff -u -p -r1.331.2.20.2.24.2.8 zend_execute_API.c --- Zend/zend_execute_API.c 7 Oct 2007 05:22:03 -0000 1.331.2.20.2.24.2.8 +++ Zend/zend_execute_API.c 1 Nov 2007 21:05:05 -0000 @@ -1545,6 +1545,7 @@ check_fetch_type: break; } + if (zend_lookup_class_ex(class_name, class_name_len, (!rt_ns_check & use_autoload), &pce TSRMLS_CC)==FAILURE) { if (rt_ns_check) { /* Check if we have internal class with the same name */ @@ -1569,6 +1570,27 @@ check_fetch_type: zend_lookup_class_ex(class_name, class_name_len, 1, &pce TSRMLS_CC)==SUCCESS) { return *pce; } + + if (strcmp(class_name, "self") == 0) { + if (!EG(scope)) { + zend_error(E_ERROR, "Cannot access self:: when no class scope is active"); + } + return EG(scope); + } else if (strcmp(class_name, "parent") == 0) { + if (!EG(scope)) { + zend_error(E_ERROR, "Cannot access parent:: when no class scope is active"); + } + if (!EG(scope)->parent) { + zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); + } + return EG(scope)->parent; + } else if (strcmp(class_name, "static") == 0) { + if (!EG(called_scope)) { + zend_error(E_ERROR, "Cannot access static:: when no class scope is active"); + } + return EG(called_scope); + } + if (!silent) { if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) { zend_error(E_ERROR, "Interface '%s' not found", class_name);