From ee226b961c2871dd2f454fa707fc23e4af5cf263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 8 Dec 2014 15:24:44 +0100 Subject: [PATCH 1/2] Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor) --- Zend/tests/traits/bug65576a.phpt | 31 ++++++++++++++++++++++++++++++ Zend/tests/traits/bug65576b.phpt | 33 ++++++++++++++++++++++++++++++++ Zend/zend_compile.c | 4 ++-- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/traits/bug65576a.phpt create mode 100644 Zend/tests/traits/bug65576b.phpt diff --git a/Zend/tests/traits/bug65576a.phpt b/Zend/tests/traits/bug65576a.phpt new file mode 100644 index 00000000000..49b2ba0c964 --- /dev/null +++ b/Zend/tests/traits/bug65576a.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #65576 (Constructor from trait conflicts with inherited constructor) +--FILE-- +clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; @@ -3867,7 +3867,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint zend_str_tolower_copy(lowercase_name, ce->name, ce->name_length); lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC); if (!memcmp(mname, lowercase_name, mname_len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name); } ce->constructor = fe; From d6eb3b49c878ce01f1d9d73eebc4d9fec4330573 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 12 Dec 2014 15:06:04 +0100 Subject: [PATCH 2/2] Updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 7f3f98d181e..a0dcf344d8d 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Upgraded crypt_blowfish to version 1.3. (Leigh) . Fixed bug #60704 (unlink() bug with some files path). . Fixed bug #65419 (Inside trait, self::class != __CLASS__). (Julien) + . Fixed bug #65576 (Constructor from trait conflicts with inherited + constructor). (dunglas at gmail dot com) . Fixed bug #55541 (errors spawn MessageBox, which blocks test automation). (Anatol) . Fixed bug #68297 (Application Popup provides too few information). (Anatol)