From:
Operating system: MacOS X 10.7
PHP version: 5.4.0RC8
Package: Compile Warning
Bug Type: Feature/Change Request
Bug description:No conflict resolution for properties in traits
Description:
------------
There is no way to resolve a conflict in two used traits with the same
property. The resolution method used to resolve conflicting method names
should be able to be used similarly on properties.
I realize this may be the intended behavior to discourage use of properties
in traits as properties were not originally intended in traits, but since
properties are allowed, there should be a way to resolve the conflict, and
the solution is simple and fits with existing syntax.
Test script:
---------------
<?php
trait testone {
public $test;
}
trait testtwo {
public $test;
}
//** this should work but doesn't
class traittest {
use testtwo, testone {
testone::$test insteadof testtwo;
testtwo::$test as $testalso;
}
}
?>
Expected result:
----------------
No errors or warnings.
Actual result:
--------------
Parse error: syntax error, unexpected '$test' (T_VARIABLE), expecting
identifier (T_STRING) in index.php on line 14
--
Edit bug report at https://bugs.php.net/bug.php?id=61147&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61147&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61147&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61147&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61147&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61147&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61147&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61147&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61147&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61147&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61147&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61147&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61147&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61147&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61147&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61147&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61147&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61147&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61147&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61147&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61147&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61147&r=mysqlcfg