cvs: ZendEngine2 / zend_compile.c php-src/tests/classes interfaces_002.phpt
| From: | Marcus Boerger | Date: | Wed, 17 Sep 2003 10:14:12 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c php-src/tests/classes interfaces_002.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1842@lists.php.net to get a copy of this message | ||
helly Wed Sep 17 06:14:12 2003 EDT
Modified files:
/php-src/tests/classes interfaces_002.phpt
/ZendEngine2 zend_compile.c
Log:
Go with studlyCaps in error messages/backtrace/reflection output
Index: php-src/tests/classes/interfaces_002.phpt
diff -u php-src/tests/classes/interfaces_002.phpt:1.3 php-src/tests/classes/interfaces_002.phpt:1.4
--- php-src/tests/classes/interfaces_002.phpt:1.3 Sun May 4 15:50:28 2003
+++ php-src/tests/classes/interfaces_002.phpt Wed Sep 17 06:14:11 2003
@@ -25,5 +25,5 @@
?>
--EXPECTF--
-Fatal error: Class exception_foo contains 1 abstract methods and must therefore be declared
abstract (throwable::geterrno) in %s on line %d
+Fatal error: Class exception_foo contains 1 abstract methods and must therefore be declared
abstract (throwable::getErrno) in %s on line %d
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.482 ZendEngine2/zend_compile.c:1.483
--- ZendEngine2/zend_compile.c:1.482 Mon Sep 8 19:25:57 2003
+++ ZendEngine2/zend_compile.c Wed Sep 17 06:14:12 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.482 2003/09/08 23:25:57 helly Exp $ */
+/* $Id: zend_compile.c,v 1.483 2003/09/17 10:14:12 helly Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -963,6 +963,7 @@
int name_len = function_name->u.constant.value.str.len;
int function_begin_line = function_token->u.opline_num;
zend_uint fn_flags;
+ char *lcname;
if (is_method) {
if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
@@ -977,7 +978,7 @@
}
function_token->u.op_array = CG(active_op_array);
- zend_str_tolower(name, name_len);
+ lcname = zend_str_tolower_dup(name, name_len);
init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
@@ -1002,7 +1003,7 @@
short_class_name_length = strlen(short_class_name);
}
}
- if (zend_hash_add(&CG(active_class_entry)->function_table, name, name_len+1,
&op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
+ if (zend_hash_add(&CG(active_class_entry)->function_table, lcname, name_len+1,
&op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
zend_op_array *child_op_array, *parent_op_array;
if (CG(active_class_entry)->parent
&& (zend_hash_find(&CG(active_class_entry)->function_table, name, name_len+1,
(void **) &child_op_array) == SUCCESS)
@@ -1010,6 +1011,7 @@
&& (child_op_array == parent_op_array)) {
zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1,
&op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
} else {
+ efree(lcname);
zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()",
CG(active_class_entry)->name, name);
}
}
@@ -1022,30 +1024,32 @@
fn_flags |= ZEND_ACC_PUBLIC;
}
- if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))
&& !CG(active_class_entry)->constructor) {
+ if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname,
name_len)) && !CG(active_class_entry)->constructor) {
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME,
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_DESTRUCTOR_FUNC_NAME,
sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_CLONE_FUNC_NAME,
sizeof(ZEND_CLONE_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CALL_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_CALL_FUNC_NAME,
sizeof(ZEND_CALL_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_GET_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_GET_FUNC_NAME,
sizeof(ZEND_GET_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
- } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_SET_FUNC_NAME)-1)
&& (!memcmp(function_name->u.constant.value.str.val, ZEND_SET_FUNC_NAME,
sizeof(ZEND_SET_FUNC_NAME)))) {
+ } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname,
ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
}
+
+ efree(lcname);
} else {
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_DECLARE_FUNCTION;
opline->op1.op_type = IS_CONST;
- build_runtime_defined_function_key(&opline->op1.u.constant,
function_name->u.constant.value.str.val, function_name->u.constant.value.str.len, opline
TSRMLS_CC);
+ build_runtime_defined_function_key(&opline->op1.u.constant, lcname, name_len, opline
TSRMLS_CC);
opline->op2.op_type = IS_CONST;
opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.value.str.val = estrndup(name, name_len);
+ opline->op2.u.constant.value.str.val = lcname;
opline->op2.u.constant.value.str.len = name_len;
opline->op2.u.constant.refcount = 1;
opline->extended_value = ZEND_DECLARE_FUNCTION;