summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-08-23 15:41:49 +0800
committerXinchen Hui <laruence@php.net>2012-08-23 15:41:49 +0800
commit6d1bebfcb0ad746cd0410d403a3812853a2cd457 (patch)
tree61de890b5d532060756a038443981326049c0213
parent64bd4551b4cf7820c2327312d3b335f9a89e8764 (diff)
downloadphp-git-6d1bebfcb0ad746cd0410d403a3812853a2cd457.tar.gz
Fixed bug #62358 (Segfault when using traits a lot)
-rw-r--r--NEWS5
-rw-r--r--Zend/tests/bug62358.phpt32
-rw-r--r--Zend/zend_compile.c4
3 files changed, 39 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index de19a20637..4420988839 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,7 @@ PHP NEWS
. Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence)
. Fixed bug #62716 (munmap() is called with the incorrect length).
(slangley@google.com)
- . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia)
+ . Fixed bug #62358 (Segfault when using traits a lot). (Laruence)
. Fixed bug #62328 (implementing __toString and a cast to string fails)
(Laruence)
. Fixed bug #51363 (Fatal error raised by var_export() not caught by error
@@ -28,6 +28,9 @@ PHP NEWS
. Fixed bug #62852 (Unserialize invalid DateTime causes crash).
(reeze.xia@gmail.com)
+- Installation:
+ . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia)
+
- PDO:
. Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence)
diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt
new file mode 100644
index 0000000000..35d8b483d9
--- /dev/null
+++ b/Zend/tests/bug62358.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #62358 (Segfault when using traits a lot)
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") !== "0") {
+ die("skip Need Zend MM enabled");
+}
+?>
+--FILE--
+<?php
+
+trait T {
+ public function foo() {
+ echo "from T";
+ }
+}
+
+interface I {
+ public function foo();
+}
+
+abstract class A implements I{
+ use T;
+}
+
+class B extends A {
+ public function foo($var) {
+ }
+}
+?>
+--EXPECTF--
+Strict Standards: Declaration of B::foo() should be compatible with A::foo() in %sbug62358.php on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 841e1b9316..21e5ca2f6b 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3786,7 +3786,6 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
}
fn->common.scope = ce;
- fn->common.prototype = prototype;
if (prototype
&& (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT
@@ -3801,11 +3800,14 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int
if (prototype) {
do_inheritance_check_on_method(fn, prototype TSRMLS_CC);
}
+
/* one more thing: make sure we properly implement an abstract method */
if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
}
+ fn->common.prototype = prototype;
+
/* delete inherited fn if the function to be added is not abstract */
if (existing_fn
&& existing_fn->common.scope != ce