diff options
author | Xinchen Hui <laruence@php.net> | 2013-02-21 18:20:48 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2013-02-21 18:20:48 +0800 |
commit | f39d12c8210df2bc6dd0ead5d6bc63df63eea45f (patch) | |
tree | 55d7e424d5e1a351129e3918cf0d4fa3e41ec1cc /Zend/zend_compile.c | |
parent | 22ae9efe6ef46d61e932e8ef3376dd1cfa150d77 (diff) | |
parent | 9a44a9806c7c7a8c1fc691210335d0691a4597be (diff) | |
download | php-git-f39d12c8210df2bc6dd0ead5d6bc63df63eea45f.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 701151106a..e45419d3f0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4048,12 +4048,16 @@ 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, Only traits may be used in 'as' and 'insteadof' statements", trait->name); + } + for (i = 0; i < ce->num_traits; i++) { if (ce->traits[i] == trait) { return; } } - zend_error(E_COMPILE_ERROR, "Trait %s is not used", trait->name); + zend_error(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name, ce->name); } /* }}} */ |