summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2010-04-04 23:28:20 (GMT)
committerStanislav Malyshev <stas@php.net>2010-04-04 23:28:20 (GMT)
commit5f6a39d531c066e7e30091807dc7ba81abef420f (patch)
treef61d93f7380f48d35f8d4ee5b01dc7dbd175ba28 /Zend
parentf3d312ce872e48a9d0af1e7352b97b662de2787c (diff)
downloadphp-5f6a39d531c066e7e30091807dc7ba81abef420f.tar.gz
change namespaced ctors - only __construct would work
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/ns_063.phpt3
-rw-r--r--Zend/zend_compile.c21
2 files changed, 8 insertions, 16 deletions
diff --git a/Zend/tests/ns_063.phpt b/Zend/tests/ns_063.phpt
index 1be0009..dbe34b4 100644
--- a/Zend/tests/ns_063.phpt
+++ b/Zend/tests/ns_063.phpt
@@ -1,5 +1,5 @@
--TEST--
-063: Support for old-style constructors in namesapces
+063: Old-style constructors in namesapces (not supported!)
--FILE--
<?php
namespace Foo;
@@ -9,5 +9,6 @@ class Bar {
}
}
new Bar();
+echo "ok\n";
--EXPECT--
ok
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 13b6c55..ddae339 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1270,22 +1270,13 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
}
}
} else {
- char *short_class_name;
- int short_class_name_length;
- char *short_class_lcname;
-
- if ((short_class_name = zend_memrchr(CG(active_class_entry)->name, '\\', CG(active_class_entry)->name_length))) {
- short_class_name_length = CG(active_class_entry)->name_length - (short_class_name - CG(active_class_entry)->name) - 1;
- ++short_class_name;
- } else {
- short_class_name = CG(active_class_entry)->name;
- short_class_name_length = CG(active_class_entry)->name_length;
- }
- short_class_lcname = do_alloca(short_class_name_length + 1, use_heap);
- zend_str_tolower_copy(short_class_lcname, short_class_name, short_class_name_length);
+ char *class_lcname;
+
+ class_lcname = do_alloca(CG(active_class_entry)->name_length + 1, use_heap);
+ zend_str_tolower_copy(class_lcname, CG(active_class_entry)->name, CG(active_class_entry)->name_length);
/* Improve after RC: cache the lowercase class name */
- if ((short_class_name_length == name_len) && (!memcmp(short_class_lcname, lcname, name_len))) {
+ if ((CG(active_class_entry)->name_length == name_len) && (!memcmp(class_lcname, lcname, name_len))) {
if (CG(active_class_entry)->constructor) {
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
} else {
@@ -1338,7 +1329,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
}
- free_alloca(short_class_lcname, use_heap);
+ free_alloca(class_lcname, use_heap);
}
efree(lcname);