felipe                                   Thu, 06 May 2010 19:20:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299090

Log:
- Added check for 'static' on trait visibility modifier

Changed paths:
    U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c       2010-05-06 18:28:45 UTC (rev 
299089)
+++ php/php-src/trunk/Zend/zend_compile.c       2010-05-06 19:20:12 UTC (rev 
299090)
@@ -3308,8 +3308,7 @@

                if (zend_hash_quick_find(&ce->function_table, hash_key->arKey, 
hash_key->nKeyLength, hash_key->h, (void **)&class_fn) == FAILURE
                        || class_fn->common.scope != ce) {
-                               zend_error(E_WARNING, "Trait method %s has not 
been applied, because there are collisions with other trait methods on %s",
-                   fn->common.function_name, ce->name);
+                               zend_error(E_WARNING, "Trait method %s has not 
been applied, because there are collisions with other trait methods on %s", 
fn->common.function_name, ce->name);
                }

                zend_function_dtor(fn);
@@ -3318,8 +3317,7 @@
        } else {
                /* Add it to result function table */
                if (zend_hash_quick_add(resulting_table, hash_key->arKey, 
hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) {
-                       zend_error(E_ERROR, "Trait method %s has not been 
applied, because failure occured during updating resulting trait method table.",
-                 fn->common.function_name);
+                       zend_error(E_ERROR, "Trait method %s has not been 
applied, because failure occured during updating resulting trait method table", 
fn->common.function_name);
                }
        }

@@ -3476,7 +3474,7 @@
                }

                if (zend_hash_quick_update(&ce->function_table, 
hash_key->arKey, hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), 
NULL)==FAILURE) {
-                       zend_error(E_ERROR, "Trait method %s has not been 
applied, because failure occured during updating class method table.", 
hash_key->arKey);
+                       zend_error(E_ERROR, "Trait method %s has not been 
applied, because failure occured during updating class method table", 
hash_key->arKey);
                }

                _ADD_MAGIC_METHOD(ce, hash_key->arKey, hash_key->nKeyLength, 
fn);
@@ -3835,6 +3833,11 @@

        trait_alias->trait_method = 
(zend_trait_method_reference*)method_reference->u.op.ptr;
        trait_alias->modifiers = Z_LVAL(modifiers->u.constant);
+
+       if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_STATIC) {
+               zend_error(E_COMPILE_ERROR, "Cannot use 'static' as method 
modifier");
+               return;
+       }

        if (alias) {
                trait_alias->alias = Z_STRVAL(alias->u.constant);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to