php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64235
Patch deny_use_with_classes.patch revision 2013-02-21 09:09 UTC by laruence@php.net
Patch bug64235.patch revision 2013-02-20 08:07 UTC by laruence@php.net
revision 2013-02-20 07:39 UTC by laruence@php.net
Patch bug64235.phpt revision 2013-02-20 07:41 UTC by laruence@php.net

Patch bug64235.patch for Scripting Engine problem Bug #64235

Patch version 2013-02-20 07:39 UTC

Return to Bug #64235 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: laruence@php.net

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index a3f4fe5..d17e71a 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3859,6 +3859,10 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait
 {
 	zend_uint i;
 
+	if ((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) {
+		zend_error(E_COMPILE_ERROR, "Class %s is not a trait", trait->name);
+	}
+
 	for (i = 0; i < ce->num_traits; i++) {
 		if (ce->traits[i] == trait) {
 			return;
@@ -3887,7 +3891,10 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
 								ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
 					zend_error(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
 				}
-				zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
+
+				if ((cur_precedence->trait_method->ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+					zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
+				}
 
 				/** Ensure that the prefered method is actually available. */
 				lcname = zend_str_tolower_dup(cur_method_ref->method_name,
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 06:02:27 2014 UTC